IB Statements/asc

From CometWiki

Jump to: navigation, search

ASC function

Syntax: ASC(string-argument)

Discussion: The ASC function returns the decimal value of the first byte of the string-argument using the 8-bit ASCII code.

The string-argument may be a string constant, a single-element string variable, a string array element, a string expression, or a string function.

Note: If the string-argument contains more than one character, only the first byte of the string-argument is evaluated for conversion.

The resultant value for any non-null string is always a numeric value from 0 through 255. The value that results for any null string is always -1.

The intermediate result of the ASC function is stored in an accumulator with a precision of 16.0. If this intermediate result is then moved into a receiving numeric variable, its precision is adjusted to the defined precision of that variable.


In this example, the first byte of the string "SIGNATURE" (i.e., the letter "S") is converted to its decimal ASCII equivalent, namely 83. This value is stored in the variable VALUE.

Personal tools