Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ Delphi FoxPro Java Perl Python 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> |
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2008 Chilkat Software, Inc. All Rights Reserved.