Skip to content

CHR

Converts Integer to ASCII Character

This string function converts an integer into its equivalent ASCII character.

CHR (numeric-value [,ERR=line-ref|,ERC=error-code])
numeric-value
is an integer. Valid values are 0 through 255.
line-ref
is the program line number or label to branch to if an error is produced by this function.
error-code
is a programmer-defined error code. Valid values are positive or negative whole numbers.

The reverse of this function is the ASC function, which converts an ASCII character into its equivalent integer.

If numeric-value is not an integer, an ERR=26 results.

If numeric-value is negative or greater than 255, an ERR=41 results.

CHR (X)

If X=65, returns the character “A”.

CHR (NUM (NUMBER_STRING$) )

If NUMBER_STRING$ contains “65”, this returns the same character as the first example.

CHR (13)

returns the character for carriage return.

LET P$=CHR (2*X+5)

If X=30, assigns P$ the value “A”.

ASC function

From the Thoroughbred Basic Language Reference, Volume I: A–E, version 8.9.1. Open this page in the PDF