Android Question String handling problem, How to hex?

HaIm

Member
Licensed User
Longtime User
Hi

I have a problem to convert incoming string to hex16-format.
Right read content is example: BAFF6AFF1C085EFA44 (checked from RealTerm /hex -format view), but how I can convert sline-string to hex string. I can convert by Asc -command, but how to hex.

Dim sline as String
Dim Bytes() as Byte

sline=TextReader1.ReadLine
Bytes=sline.GetBytes("UTF8") ' to bytes

For i = 0 To osa.Length - 1 ' to ascii value to log
Log(Asc (osa.CharAt(i)))
Next

' How to hex16 format? Target is sline content "BAFF6AFF1C085EFA44"
 

walterf25

Expert
Licensed User
Longtime User
Hi

I have a problem to convert incoming string to hex16-format.
Right read content is example: BAFF6AFF1C085EFA44 (checked from RealTerm /hex -format view), but how I can convert sline-string to hex string. I can convert by Asc -command, but how to hex.

Dim sline as String
Dim Bytes() as Byte

sline=TextReader1.ReadLine
Bytes=sline.GetBytes("UTF8") ' to bytes

For i = 0 To osa.Length - 1 ' to ascii value to log
Log(Asc (osa.CharAt(i)))
Next

' How to hex16 format? Target is sline content "BAFF6AFF1C085EFA44"
Use the ByteConverter library!

Walter
 
Upvote 0
Top