Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
|
|
Convert String to Byte Array FunctionASP function to convert a string to a byte array. <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body> <% ' ' String to byte array conversion function: Function StringToByteArray(s) Dim i, byteArray For i=1 To Len(s) byteArray = byteArray & ChrB(Asc(Mid(s,i,1))) Next StringToByteArray = byteArray End Function s = "ABCDEFG" ' Convert the string to a byte array. Dim byteArray byteArray = StringToByteArray(s) ' Display the length of the byte array Response.Write CStr(LenB(byteArray)) & "<p>" ' Display the bytes as decimal integers: Dim d d = "" For i = 1 To LenB(byteArray) d = d & CStr(AscB(MidB(byteArray, i, 1))) & "," Next Response.Write "<p>" & d & "</p>" ' Output: 65,66,67,68,69,70,71, %> </body> </html> |
© 2000-2012 Chilkat Software, Inc. All Rights Reserved.