NAME

asc - return the ASCII code for a character

SYNOPSIS

v = asc(StrExpr)

DESCRIPTION

Asc returns the ASCII code for the first character of the string expression specified by its argument.  Characters beyond the first character of the string are ignored.  StrExpr may be any string expression. 

The asc function is the inverse of the chr$ function in the sense that asc(chr$(NumExpr)) equals NumExpr for any numeric expression NumExpr whose value is between 0 and 255 inclusive.  However, asc and chr$ are not true inverses since chr$(asc(StrExpr)) equals StrExpr only for string expressions StrExpr of a single character. 

EXAMPLE

Since the ASCII code for a capital ’B’ is 66, the program
	b$ = "Basmark QuickBASIC"
	print asc(b$)
	print asc("Basmark QuickBASIC")
produces
	66
	66

SEE ALSO

chr$

DIAGNOSTICS

If the value of the argument to asc is the null string, an "Illegal function call" error occurs. 

from The Basmark QuickBASIC Programmer’s Manual by Lawrence Leinweber