ASC(string)
ASCB(string)
ASCW(string)
Description
ASC returns the ANSI character code of a character. The required parameter, string, is any valid string expression. If string is longer than one character, only the first character is used.
The ASCB function is used with byte data contained in a string. Instead of returning the character code for the first character, ASCB returns the first byte. ASCW is provided for 32-bit platforms that use Unicode characters. It returns the Unicode (wide) character code, thereby avoiding the conversion from Unicode to ANSI.
Example
REM ASC Example
'ASC returns an ANSI character code
DIM CapitalA, LowerB
CapitalA = ASC("A is for Apple")
PRINT "Character code for A = " & CapitalA
LowerB = ASC("b")
PRINT "Character code for b = " & LowerB
Output
Character code for A = 65
Character code for b = 98
Related Items
CHR