StringToBytes
Previous  Next

Returns an array of bytes from the ASCII values of the characters in the string.
Syntax: StringToBytes (string As String, index As Int32, count As Int32) As Byte()

string - The string of characters which will be converted.
index - The index of the first character to be converted.
count - The number of character to convert.

Example:
'First add a Bitwise object named bit.
Sub Globals
      Dim buffer(0) as Byte 'Declares an empty array
End Sub

Sub App_Start
      bit.New1
      buffer() = bit.StringToBytes("AB CDE",0,5)
      msgbox("Array length: " & ArrayLen(buffer())) 'Will display 5
      msgbox(buffer(1)) 'Will display 66 (the ASCII value of 'B')
End Sub