[DUG] Ord value of String character
Stephen Barker
Steve at webdata.co.nz
Thu Oct 26 12:24:06 NZDT 2006
Works for me:
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessage(IntToStr(Ord(Edit1.Text[1])));
end;
Regards,
Steve
> -----Original Message-----
> From: Laurence Bevan [mailto:Laurence at master.co.nz]
> Sent: Thursday, 26 October 2006 9:31 a.m.
> To: delphi at ns3.123.co.nz
> Subject: [DUG] Ord value of String character
>
> This is probably simple but I can't get my head around it
> this morning. I have a string variable of which I want to
> obtain the ASCII value of the first character in the string.
>
> I've tried Ord(String[1]) but keep getting an error. Do I
> need to cast the first character to a Byte type or something?
>
> Cheers,
> Laurence
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.408 / Virus Database: 268.13.11/496 - Release
> Date: 24/10/2006
>
>
>
More information about the Delphi
mailing list