| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Returns the ASCII code for characters.
ASC( <cCharacter> ) --> nAsciiCode
The functions returns the numeric ASCII code for <cCharacter>.
This function returns the ASCII value of the leftmost character of any character expression.
Note: passing a null string ("") yields 0. It is the same result as passing Chr(0). A null string, however, is different from Chr(0).
| See also: | Chr(), Inkey(), Str(), Val() |
| Category: | Conversion functions |
| Source: | rtl\chrasc.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example displays the ASCII values of several characters and
// character strings
PROCEDURE Main()
? Asc( " " ) // result: 32
? Asc( "A" ) // result: 65
? Asc( "a" ) // result: 97
? Asc( "xHarbour" ) // result: 120
? Asc( "XHARBOUR" ) // result: 88
RETURN
http://www.xHarbour.com