Re: ASCII CodesPosted by webmaster Guido on June 11, 2003 at 21:56:34: In Reply to: Re: ASCII Codes posted by Brett Kingston on June 09, 2003 at 15:14:20:
: What data type is required for this? Ord(C) needs a parameter C of type "char" (character). So, this will work: var AsciiVal: integer; C: Char; S: string; begin C := 'B'; AsciiVal := Ord(C); // gives ASCII-code of 'B' AsciiVal := Ord(Edit1.Text[1]); // ASCII-code of first character of text in Edit1 S := 'Test'; AsciiVal := Ord(S[2]); // ASCII-code of 'e' But the following will not work: AsciiVal := Ord(Edit1.Text); // error because Edit1.Text is of type "string"
[ DelphiLand: free Delphi source code, tips, tutorials ] |
|