ord() takes a character expression as an argument and returns the integer value of the first byte of that argument.
For the default (U.S. English) locale, ord() is the logical inverse of the ASCII operator. Only the first byte of the argument is evaluated.
This line assigns the value 66 to the integer my_ord:
LET my_ord = ORD ("Querix")
This built-in function is case sensitive; if the first character in its argument is an uppercase letter, ord() returns a value different from that which it would return if its argument had begun with a lowercase letter.
The example program displays ord() results to the message string:
MAIN
DEFINE str CHAR(20)
OPEN WINDOW w1 WITH FORM "ord_function"
INPUT BY NAME str
ON ACTION ACCEPT
LET str = fgl_dialog_getbuffer()
MESSAGE "ORD():", ord(str)
END INPUT
CLOSE WINDOW w1
END MAIN
.per form
DATABASE FORMONLY
SCREEN
{
Enter a string and press
ACCEPT button:
[f1 ]
}
ATTRIBUTES
f1=FORMONLY.str;
INSTRUCTIONS
SCREEN RECORD s_rec (
FORMONLY.str
)
DELIMITERS "[]"