ASCII()

The ASCII() operator produces an ASCII character.

Syntax

ASCII ( int-expr )
  1. int-expr is an integer expression, in the range 0-255 or 0-127, according to the current locale.

Usage

The ASCII() operator returns the character corresponding to the ASCII code passed as a parameter.

ASCII() is typically used to generate a non-printable character such as newline or escape. You should avoid to use this function for other characters.

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.
  • For any other locale setting (any multibyte character set, or UTF-8 with byte length semantics), the argument must be in the range 0 to 127.
When the argument is zero, ASCII() has a different behavior, according to the context:
  • ASCII(0) only displays the NULL character within the PRINT 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