Android Question Convert String to ASCII

imgsimonebiliato

Well-Known Member
Licensed User
Longtime User
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
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:
Upvote 0

imgsimonebiliato

Well-Known Member
Licensed User
Longtime User
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

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:
Upvote 0

AlpVir

Well-Known Member
Licensed User
Longtime User
Upvote 0
Top