System Functions

CHR( )

ASCII Character of Value

Format

CHR(num[,ERR=stmtref])

Where:

num

Value of the character to return. Numeric expression. Range: integer from 0 to 255 (the character's number in the ASCII table).

stmtref

Program line number or statement label to which to transfer control.

Returns

Single ASCII character.

Description

The CHR( ) function returns a single-character ASCII string of the numeric expression defined by num. The value of num must be an integer in a range from 0 to 255 (the position of the character in the ASCII table). The first printable character in the ASCII character set is the blank, $20$, which is CHR(32).

Special * Option:
Using CHR(*) allows the programmer to access the table non-printable characters. The table consists of a string 256 bytes long where each byte contains a $00$ or $01$.

$01$ indicates a printable character, and $00$ indicates non-printable. See DEF CHR directive.

(The ability to access/change the printable character tables was added in PxPlus v7.10.)

See Also

ASC( ) Get Internal Character Value

Example

X$=chr(65) ! (Sets X$ to "A")
X$=chr(33) ! (Sets X$ to "!")