ASCII()
The ASCII()
operator
produces an ASCII character.
Syntax
ASCII ( int-expr )
- int-expr is an integer expression, in the range 0-255 or 0-127, depending on the current locale.
Usage
The ASCII()
operator returns the character corresponding to the ASCII code
passed as a parameter, in the current encoding of the application locale.
The possible values of the integer parameter passed to
ASCII()
depends on the
locale settings: - For single byte encodings (like ISO8859-1), the argument must be in the range of 0 to 255.
- For UTF-8, using char length semantics, the argument must be any valid 16bit code point (in the range 0-65535).
- For any other locale setting (any multibyte character set, or UTF-8
using byte length semantics
), the argument must be in the range 0 to 127.
ASCII()
function can be also used to produce special characters such as
escape (ASCII(27)
), newline (ASCII(10)
), horizontal tab
(ASCII(9)
).When the argument is zero,
ASCII()
has a different behavior, depending on the
context: ASCII(0)
only displays theNULL
character within thePRINT
statement.- If you specify
ASCII(0)
in other contexts, it returns a blank space.
Example
MAIN
DISPLAY ASCII(65), ASCII(66), ASCII(7)
END MAIN