From Clomosy Docs

Revision as of 13:09, 13 February 2024 by ClomosyManager (talk | contribs)

function Ord(Arg AnsiChar | Char | WideChar | Enumeration | Integer):Integer;

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.

Example:

Base Syntax
 var
   S   : AnsiChar;
   M   : Char;
   W   : WideChar;
   control   : Boolean;
   number   : Integer;
   I64 : Int64;
 
 begin
 
   // Set type values
   S   := 'S';
   M   := 'M';
   W   := 'W';
   control   := True;
   number   := 22;
   I64 := 64;
 
   // Show value
   ShowMessage('S = '+IntToStr(Ord(S)));
   ShowMessage('M = '+IntToStr(Ord(M)));
   ShowMessage('W = '+IntToStr(Ord(W)));
   ShowMessage('control = '+IntToStr(Ord(control)));
   ShowMessage('number = '+IntToStr(Ord(number)));
   ShowMessage('I64 = '+IntToStr(Ord(I64)));
 
 end;
TRObject Syntax
 var
   S   : AnsiChar;
   M   : Char;
   W   : WideChar;
   control   : Boolean;
   number   : Integer;
   I64 : Int64;
 
 {
 
   // Set type values
   S   = 'S';
   M   = 'M';
   W   = 'W';
   control   = True;
   number   = 22;
   I64 = 64;
 
   // Show value
   ShowMessage('S = '+IntToStr(Ord(S)));
   ShowMessage('M = '+IntToStr(Ord(M)));
   ShowMessage('W = '+IntToStr(Ord(W)));
   ShowMessage('control = '+IntToStr(Ord(control)));
   ShowMessage('number = '+IntToStr(Ord(number)));
   ShowMessage('I64 = '+IntToStr(Ord(I64)));
 
 }

Output:

S = 83
M = 77
W = 87
control = -1
number = 22
I64 = 64