ASC
Returns Integer Value of ASCII Character
This numeric function returns the unsigned integer value of a single ASCII character.
Syntax
Section titled “Syntax”ASC (string-value [,ERR=line-ref|,ERC=error-code])string-value- is any string.
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.
Remarks
Section titled “Remarks”The string-value may be of any valid length but only the integer value of the first character is returned.
Note that the DEC function is an extension of the ASC function. ASC operates on only a single character while DEC can operate on a character string.
The reverse of ASC is the CHR function, which can convert an integer value into a corresponding ASCII character.
If string-value is null, an ERR=46 results.
Examples
Section titled “Examples”ASC ("A")returns the numeric value 65 (decimal code for the character A).
ASC (S$)If S$=“BUG”, returns the value 66 since only the first character is evaluated.
LET X=ASC (R$,ERR=8000)If R$=“” (an empty or null string), an error is produced and control is given to statement 8000.
See also
Section titled “See also”From the Thoroughbred Basic Language Reference, Volume I: A–E, version 8.9.1. Open this page in the PDF