bjornborg
asked on
Convert String to Char?
This is probably very easy, but still:
I would like to return the ord() value of a character:
ord('c') returns 99
but if I try to extract the letter from a string like this:
Mystring := midstr(strLongString,nbrSt artPos,1); //e.g 'c'
and then want to use the function
nbrThatItIs := ord(Mystring);
I get an error because Mystring is "string" and I need to use Char.
So: How do I best convert my string to char?
I would like to return the ord() value of a character:
ord('c') returns 99
but if I try to extract the letter from a string like this:
Mystring := midstr(strLongString,nbrSt
and then want to use the function
nbrThatItIs := ord(Mystring);
I get an error because Mystring is "string" and I need to use Char.
So: How do I best convert my string to char?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Umm, yeah, that's right! Sorry about the little mixup :).
GL
Mike
GL
Mike
in a string" and the _third_ in a PChar. :-)
s = '123';
ord(s[2]); -> "2"
ord(PChar(s)[2]); -> "3"