SystemOrd (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example displays the ordinal value for different enumerations.

Code

procedure TForm1.Button1Click(Sender: TObject);
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, TMsgDlgType.mtInformation, [TMsgDlgBtn.mbOk], 0, TMsgDlgBtn.mbOK);
end;

Uses