ObjectPascal
Ord
Function
Provides the Ordinal value of an integer, character or enum System unit
1  function Ord ( Arg : AnsiChar | Char | WideChar | Enumeration | Integer ) : Integer;
2  function Ord ( Arg : Int64 ) : Int64;
Description
The Ord function returns an integer value for any ordinal type Arg.
 
It is principally used to convert characters or enumerations into their numeric equivalents.
Related commands
Char Variable type holding a single character
Chr Convert an integer into a character
Val Converts number strings to integer and floating point values
 
Example code : Illustrate all Ord types
var
  A   : AnsiChar;
  C   : Char;
  W   : WideChar;
  E   : Boolean;
  I   : Integer;
  I64 : Int64;

begin
  // Set the ordinal type values
  A   := 'A';
  C   := 'C';
  W   := 'W';
  E   := True;
  I   := 22;
  I64 := 64;

  // And show the value of each
  WriteLn('A = '+IntToStr(Ord(A)));
  WriteLn('C = '+IntToStr(Ord(C)));
  WriteLn('W = '+IntToStr(Ord(W)));
  WriteLn('E = '+IntToStr(Ord(E)));
  WriteLn('I = '+IntToStr(Ord(I)));
  WriteLn('I64 = '+IntToStr(Ord(I64)));
end;
Show full unit code
   A = 65
   C = 67
   W = 87
   E = 1
   I = 22
   I64 = 64