1.ord()函数:
Returns the ordinal value of an ordinal-type expression.
返回一个序数类型表达式的序数值;
Example:
uses Dialogs;
type
Colors = (RED,BLUE,GREEN);
var
S: string;
begin
S := 'BLUE has an ordinal value of ' + IntToStr(Ord(BLUE)) + #13#10;
S := S + 'The ASCII code for "c" is ' + IntToStr(Ord('c')) + ' decimal';
MessageDlg(S, mtInformation, [mbOk], 0);
end;
--------Delphi帮助
2.在delphi中只可以ord(英文)不可以ord(汉字)请问如何在delphi中实现对汉字ascii码的获得小生不才,望高手赐教,在此谢过!!
答:
procedure TForm1.FormCreate(Sender: TObject);
var
a: string;
begin
a := '啊';
S howMessage(IntToStr(ord(a[1])));
ShowMessage(IntToStr(ord(a[2])));
end;
3. ORD函数是用于取得一个ASCII码的数值。 CHR函数正好相反,用于取得一个数值的ASCII值。
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/xufeichen/archive/2009/08/24/4480697.aspx