Asc Function

Description

Returns the character code corresponding to the first letter in a string.

Syntax

Asc(string)

The string argument is any valid string expression. If the string contains no characters, a run-time error occurs.

Note Another function (AscB) is provided for use with byte data contained in a string. Instead of returning the character code for the first character, AscB returns the first byte.

See Also

Chr Function.

Example

This example uses the Asc function to return a character code corresponding to the first letter in the string.


MyNumber = Asc("A")        ' Returns 65.= Asc("a")        ' Returns 97.= Asc("Apple")    ' Returns 65.