Previous Topic: String Manipulation FunctionsNext Topic: Chr - Convert Integer to Wide Character


Asc - Convert a Character to an ASCII Value

Valid on NetWare, Symbian OS, UNIX, Windows and Windows CE

The asc function converts a character to its corresponding ASCII value or the wide character code of a glyph. If parameter s1 is a string and contains more than one character, the function evaluates the first character only.

Function format:

Asc(s1 as String) as Integer
Asc(s1 as Char) as Integer
s1

Identifies name of character

The return value is the wide character code value of the input character or the first character of the input string.

Example:

Dim OutStr as string

OutStr = Str(Asc("A"))+" "+Str(Asc("B"))+" "+Str(Asc("C"))

Print "AscII Values of the letters in ""ABC"" is: " + OutStr