I would like to step through a string of 23 characters and convert each character to its binary equivalent so I can check each byte's bits against a flag table.......
Has anyone got a sinple way of stepping through each byte in a string?
I would like to step through a string of 23 characters and convert each character to its binary equivalent so I can check each byte's bits against a flag table.......
Has anyone got a sinple way of stepping through each byte in a string?
This code will step through each byte in hexString and convert hexString to a binary string binaryString.
B4X:
Dim binaryString As String = ""
Dim byteString As String
Dim zeros As String = "00000000"
If hexString.Length Mod 2 = 1 Then hexString = "0" & hexString
For i = 0 To hexString.Length - 1 Step 2
byteString = Bit.ToBinaryString(Bit.ParseInt(hexString.SubString2(i, i+2), 16))
byteString = zeros.SubString(byteString.Length) & byteString
binaryString = binaryString & byteString
Next