Asc Function | |
Convert a character to its ASCII value.
Namespace:
XSharp.Core
Assembly:
XSharp.Core (in XSharp.Core.dll) Version: 2.21
Syntax FUNCTION Asc(
cString AS STRING
) AS DWORD
public static uint Asc(
string cString
)
Request Example
View SourceParameters
- cString
- Type: String
The character to convert to a number.
Return Value
Type:
DWord
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.
Remarks
The return value of Asc() in XSharp depends on the setting of SetAnsi().
When SetAnsi() = TRUE then the active windows Ansi codepage is used to calculate the result.
When SetAnsi() = FALSE then the active windows Oem codepage is used to calculate the result.
This is different from the behior in most single byte versions of Xbase where Asc() simply returnes the
byte value of the 1st character of the string.
Examples
These examples illustrate various results of Asc():
1? Asc("A")
2? Asc("Apple")
3? Asc("a")
4? Asc("Z") - Asc("A")
5? Asc(NULL_STRING)
6? Asc(Chr(0))
See Also