M Mostez Well-Known Member Licensed User Longtime User Nov 14, 2016 #1 Hello, How can I get single character of string by it's index i.e. vString as String = get("ABCD",2) returns 'C' not ascii value of 'C' Thanks
Hello, How can I get single character of string by it's index i.e. vString as String = get("ABCD",2) returns 'C' not ascii value of 'C' Thanks
Erel B4X founder Staff member Licensed User Longtime User Nov 15, 2016 #2 B4X: Dim s() As Byte = "ABCD" Dim b As Byte = s(2) The value of b will be 67 which is the ascii code of 'C'. In most cases it is better to work with bytes and leave it as is. You can convert it to string with: B4X: Dim bc As ByteConverter Dim st As String = bc.StringFromBytes(Array As Byte(b)) Upvote 0
B4X: Dim s() As Byte = "ABCD" Dim b As Byte = s(2) The value of b will be 67 which is the ascii code of 'C'. In most cases it is better to work with bytes and leave it as is. You can convert it to string with: B4X: Dim bc As ByteConverter Dim st As String = bc.StringFromBytes(Array As Byte(b))