imgsimonebiliato Well-Known Member Licensed User Longtime User Aug 28, 2013 #1 Hello, please how can I convert a string to the corresponding ASCII Decimal, without passing for HEX Ascii?
Hello, please how can I convert a string to the corresponding ASCII Decimal, without passing for HEX Ascii?
rbsoft Active Member Licensed User Longtime User Aug 28, 2013 #2 This mght help: B4X: Dim t as String Dim a() As Byte t = "abcd" a = t.GetBytes("UTF8") Log(a(1)) or for a single character: B4X: Dim a() As Byte a = "a".GetBytes("UTF8") Log(a(0)) Rolf Last edited: Aug 28, 2013 Upvote 0
This mght help: B4X: Dim t as String Dim a() As Byte t = "abcd" a = t.GetBytes("UTF8") Log(a(1)) or for a single character: B4X: Dim a() As Byte a = "a".GetBytes("UTF8") Log(a(0)) Rolf
imgsimonebiliato Well-Known Member Licensed User Longtime User Aug 28, 2013 #3 rbsoft said: This mght help: B4X: Dim t as String Dim a() As Byte t = "abcd" a = t.GetBytes("UTF8") Log(a(1)) or for a single character: B4X: Dim a() As Byte a = "a".GetBytes("UTF8") Log(a(0)) Rolf Click to expand... Thank Rolf for your reply. Can you help me also, if I need to convert a string to char value? I want to obtain: string -> ascii perchè = 112 101 114 99 104 232 Last edited: Aug 28, 2013 Upvote 0
rbsoft said: This mght help: B4X: Dim t as String Dim a() As Byte t = "abcd" a = t.GetBytes("UTF8") Log(a(1)) or for a single character: B4X: Dim a() As Byte a = "a".GetBytes("UTF8") Log(a(0)) Rolf Click to expand... Thank Rolf for your reply. Can you help me also, if I need to convert a string to char value? I want to obtain: string -> ascii perchè = 112 101 114 99 104 232
Erel B4X founder Staff member Licensed User Longtime User Aug 28, 2013 #4 B4X: For i = 0 To SomeString.Length - 1 Log(Asc(SomeString.CharAt(i))) Next Upvote 0
imgsimonebiliato Well-Known Member Licensed User Longtime User Aug 28, 2013 #5 Erel said: B4X: For i = 0 To SomeString.Length - 1 Log(Asc(SomeString.CharAt(i))) Next Click to expand... Many thanks! Upvote 0
Erel said: B4X: For i = 0 To SomeString.Length - 1 Log(Asc(SomeString.CharAt(i))) Next Click to expand... Many thanks!
AlpVir Well-Known Member Licensed User Longtime User Aug 28, 2013 #6 In the library StringFunctions there is the possibility to have a MsgBox with all the ASCII codes of the string ( http://www.b4x.com/android/forum/threads/string-functions.10365/#content ) AsciiCodes Displays a MessageBox with all Characters and their ASCII codes. Upvote 0
In the library StringFunctions there is the possibility to have a MsgBox with all the ASCII codes of the string ( http://www.b4x.com/android/forum/threads/string-functions.10365/#content ) AsciiCodes Displays a MessageBox with all Characters and their ASCII codes.