procedure TForm1.Button2Click(Sender: TObject); begin ShowMessage(IntToStr(Ord('A'))); Caption := Chr(65); end;/////////////////////////////////////////////////////////////////////////////////function Ord(X);DescriptionX is an ordinal-type expression. The result is the ordinal position of X; its type is the smallest standard integer type that can hold all values of X's type.Ord cannot operate on Int64 values.////////////////////////////////////////////////////////////////////////////////function Chr(X: Byte): Char;DescriptionChr returns the character with the ordinal value (ASCII value) of the byte-type expression, X.
integer('A')=48
以上就可以强制转换
begin
ShowMessage(IntToStr(Ord('A')));
Caption := Chr(65);
end;/////////////////////////////////////////////////////////////////////////////////function Ord(X);DescriptionX is an ordinal-type expression. The result is the ordinal position of X; its type is the smallest standard integer type that can hold all values of X's type.Ord cannot operate on Int64 values.////////////////////////////////////////////////////////////////////////////////function Chr(X: Byte): Char;DescriptionChr returns the character with the ordinal value (ASCII value) of the byte-type expression, X.