Char Function

Generates an ASCII character from its numeric code value.

Syntax

Char (code)

code is the ASCII code value of the character or an expression evaluating to the code.

Remarks

Be careful with null values. If code is a null value, null is returned. If code is 128, the returned value is CHAR(128), that is, the system variable @NULL.STR.

The Char function is the inverse of the Seq function.

Note: If NLS is enabled, values for code in the range 129 through 247 return Unicode values in the range x0081 through x00F7. These are multibyte characters equivalent to the same values in the ISO 8859 (Latin 1) character set. To generate the specific bytes with the values 129 through 247, use the Byte function.

Example

This example uses the Char function to return the character associated with the specified character code:

MyChar = Char(65)    ;* returns "A"
MyChar = Char(97)    ;* returns "a"
MyChar = Char(32)    ;* returns a space
MyChar = Char(544) 
* returns a space (544 = 32 modulus 256)