I got a string like str='A' and I would like to get the ASCII-code from it.
It works fine with char='A' and Integer(char), but i just don´t know how to
convert it.
Michael Sander
var str : string;
begin
str:='A';
showmessage(inttostr(ord(str[1])));
end;
johannes
--
Please reply in this newsgroup only
- SIP solutions -
http://www.sipsolutions.de/
1. str[1] returns the first character (as type Char) from the string.
2. Ord( a ) returns the ASCII value of the character a.
3. IntToStr( x ) returns the string representation of the integer value x.
So, IntToStr( Ord( str[1] ) ) returns the string representation of the ASCII
code for the first character of str.
-Howard