From Clomosy Docs

No edit summary
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 6: Line 6:


<b>Example</b><br>
<b>Example</b><br>
<b>TRObject Syntax</b><br>
 
<pre>
<pre>
var
var
Line 36: Line 36:
}
}
</pre>
</pre>
<b>Base Syntax</b><br>
<pre>
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;
</pre>
'''Output:'''<br>
S = 83
M = 77
W = 87
control = -1
number = 22
I64 = 64


<b>Output:</b><br>
<b>Output:</b><br>
Line 86: Line 49:
<h2> See Also </h2>
<h2> See Also </h2>
* [[System_Library#Math_Functions | Math Functions]]
* [[System_Library#Math_Functions | Math Functions]]
{{#seo:|title=Ord Usage Guide - Clomosy Docs}}
{{#seo:|description=Explore the Ord function in Clomosy. A simple yet powerful tool to handle character-to-numeric conversions for streamlined app logic.}}

Latest revision as of 13:06, 24 December 2024

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

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:

See Also