Click to See Complete Forum and Search --> : STRINGS!!! Help!!!


Sascha W.
September 16th, 1999, 11:02 AM
How is it possible to get the hex or decimal value of one charater from a string?
For example: I want the decimal value of the "a" from the "hallo" string. Does anybody know how to do that? Code would be helpful.
Thanks and redards
Sascha

Lothar Haensler
September 16th, 1999, 11:08 AM
MsgBox Hex$(Asc("a"))

Sascha W.
September 16th, 1999, 11:20 AM
Hi Lothar,
sorry if I didn't really said what I want. I have a string e.g. with 6 characters, but I don't know the contents. Now I want the decimal value of e.g. the third character of this specific string.
Example: dim a As string
a = ??(?)???
Decimal value of the third character?
How to do that?
Tanks and regars
Sascha

Lothar Haensler
September 16th, 1999, 11:22 AM
to get a specific char from a string use the Mid function.
To convert it to a decimal value use Asc.

e.g. to convert the third char in string x

a = asc(mid(x,3,1))