Click or drag to resize

Asc Function

Convert a character to its ASCII value.

Namespace:  XSharp.Core
Assembly:  XSharp.Core (in XSharp.Core.dll) Version: 2.2a
Syntax
 FUNCTION Asc(
	cString AS STRING
) AS DWORD
View Source

Parameters

cString
Type: String
The character to convert to a number.

Return Value

Type: UInt32
A number from 0 to 255, representing the ASCII code of < cString >.
Remarks
Asc() is a character conversion function that returns the ASCII value of the leftmost character in a string.  Asc() is used primarily on expressions requiring numeric calculations on the ASCII value of a character.  Chr() and Asc() are inverse functions.
Examples
These examples illustrate various results of Asc():
X#
? Asc("A")                                // 65
? Asc("Apple")                                // 65
? Asc("a")                                        // 97
? Asc("Z") - Asc("A")                // 25
? Asc(NULL_STRING)                        // 0
? Asc(Chr(0))                                // 0
See Also