CHAR function

Syntax

CHAR (expression)

Description

Use the CHAR function to generate an ASCII character from the numeric value of expression.

If expression evaluates to the null value, null is returned. If expression evaluates to 128, CHAR(128) is returned, not the null value. CHAR(128) is the equivalent of the system variable @NULL.STR.

The CHAR function is the inverse of the SEQ function.

If NLS mode is enabled, and if expression evaluates to a number from 129 through 247, the CHAR function generates Unicode characters from x0081 through x00F7. These values correspond to the equivalent ISO 8859-1 (Latin 1) multibyte characters. The evaluation of numbers from 0 through 127, 128, and 248 through 255 remains the same whether NLS is enabled or not.

The UNICHAR function is the recommended method for generating Unicode characters.

Note: In order to run programs using the CHAR function in NLS mode, you must first recompile them in NLS mode.

Example

X = CHAR(38)
Y = CHAR(32)
PRINT X:Y:X

CHAR(38) is an ampersand ( & ). CHAR(32) is a space. This is the program output:

& &