<< Click to Display Table of Contents >> Navigation: Available Functions > Asc() |
Syntax
Asc( <CharacterValue> )
Purpose
To convert a character value to its ASCII numeric value. ASCII values are the numbers the computer uses internally to represent character values. Asc() is a character conversion function that returns the ASCII value of the left-most character in a character value. Asc() is used primarily in expressions where you need to perform numeric calculations on the ASCII value of a character. Chr() and Asc() are inverse functions.
Parameters
<CharacterValue> may be the name of a field, but is usually a single-character quoted value like "A".
Returns
A Numeric value in the range of zero to 255, representing the ASCII value of <CharacterValue>. The ASCII value of a character is the numerical representation of that character used internally by the computer.
Example
The following examples illustrate various results of Asc():
CALL |
RESULT |
---|---|
Asc( "A" ) |
65 |
Asc( "Apple" ) |
65 |
Asc( "a" ) |
97 |
Asc( "Z" ) - Asc( "A" ) |
25 |
Asc( "" ) |
0 |