Navigation: Language Reference > 13 - Built-in Functions >====== VAL (return character code value) ====== | |
VAL(character)
VAL | Returns a character code value. |
character | A one character string containing an ANSI or Unicode character. |
The VAL procedure returns the numeric code of a character. If the compiler can determine type of parameter (literal string or variable), it returns
a result of BYTE (for ANSI strings) or a USHORT (for Unicode strings). If the type of parameter can't be determined the compiler generates code to push its value to the string stack and returns a result of SIGNED type. To force a specific encoding of the character parameter you can use the TOANSI or TOUNICODE functions .
Return Data Type: BYTE, USHORT or SIGNED (See above)
Example:
VAL('A') !RETURNS 65
VAL('z') !RETURNS 122
VAL('Ж') !RETURNS 1046
VAL('Σ') !RETURNS 933
CharCode = VAL(StrChar) !Get the character code value of the character
See Also: