Purpose
Returns the character code for the first character in a string expression. You can call this function from the MapBasic window in MapInfo Pro.
Syntax
Asc( string_expr )
string_expr is a string expression.
Return Value
Integer
Description
The Asc() function returns the character code representing the first character in the string specified by string_expr.
If string_expr is a null string, the Asc() function returns a value of zero.
On a system that supports double-byte character sets (e.g., Windows Japanese): if the first character of string_expr is a single-byte character, Asc() returns a number in the range 0 - 255; if the first character of string_expr is a double-byte character, Asc() returns a value in the range 256 - 65,535.
On systems that do not support double-byte character sets, Asc() returns a number in the range 0 - 255.
In Unicode versions of MapInfo Pro, this function operates in the system character set in a compatible manner with the non-Unicode versions of MapInfo Pro.
Example
Dim code As SmallInt
code = Asc("Afghanistan")
' code will now be equal to 65,
' since 65 is the code for the letter A
See Also:
CharVal() function, Chr$() function, Character Code Table Definitions