Description:
Get the Unicode value of a character at the specified position in a string.
Syntax:
asc( string{, nPos} )
Note:
The function obtains the Unicode value of a character at the specified position nPos of string, if it is ASCII character, then returns its ASCII code.
In general, all the English characters and their extended characters are ASCII characters; Asian language characters, such as Chinese, Japanese and Korean, are recorded in Unicode. ASCII is an 8-bit character set, and Unicode is a 16-bit character set, of which 3 bits are used to indicate the character type.
Parameter:
string |
A string. |
nPos |
Integer expression, default is 1. |
Return value:
Integer
Example:
asc("def") |
100 (ascii) |
asc("def",2) |
101 (ascii) |
asc("中国") |
20013(Unicode) |
asc("中国",2) |
22269(Unicode) |
Related functions: