asc()

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, English characters and their extended characters are all the ASCII characters; Asian language characters, such as Chinese, Japanese, Korean, are all Unicode characters. ASCII character is an 8-bit character set, and the Unicode character is a 16-bit character set, of which 3 bits are used to indicate the character type.

Parameters:

string

A string

nPos

Integer expression, the default is 1

Return value:

An integer

Example:

asc("def")

100 (ascii)

asc("def",2)

101 (ascii)

asc("中国")

20013(Unicode)

asc("中国",2)

22269(Unicode)

Related functions:

char()