View Full Version : String Conversion
bethr
- 19th August 2009, 18:48
I have a two bytes string (data array)
data[0]=9
data[1]=8
how can I get from this string array the number in to a variable ?
data_var = 89
???
:rolleyes:
mackrackit
- 19th August 2009, 19:05
T = data[1] 'Tens
O = data[0] 'Ones
data_var = (T*10)+O
Maybe??
bethr
- 19th August 2009, 19:28
Pretty simple, just convert to number the ascii content
T = data[1] - 48 'Tens
O = data[0] - 48 'Ones
data_var = (T*10)+O
and it work for me, Thanks mackrackit.
Archangel
- 19th August 2009, 19:57
T = data[1] 'Tens
O = data[0] 'Ones
data_var = (T*10)+O
Maybe??
Hi Dave,
doesn't this work ?
data[0] = "T"
data[1] = "O"
or did I miss the point (again) entirely? OK, yes I did! I thought he wanted to store ascii characters in the array.
Powered by vBulletin® Version 4.1.7 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.