Purpose
Returns the character code for the first character in a string expression. This function is the Unicode corollary of the Asc() function, so that the return value maps to the Unicode character set encoding of the string expression (string_expr), rather than the system character set mapping. You can call this function from the MapBasic window in MapInfo Pro.
Syntax
CharVal( string_expr )
string_expr is a string expression.
Return Value
Integer
Description
The CharVal() function returns the character code representing the first character in the string specified by the string expression, string_expr. If string_expr is a null string, then CharVal() returns a value of zero.
CharVal() is only applicable for Unicode versions of MapInfoPro and returns a value of zero for non-Unicode versions of MapInfo Pro.
Example
The following example displays the corresponding Unicode encoding for the character, which will be 8364, 1587, and 24330:
Dim code As SmallInt
code = CharVal("€")
code = CharVal("س")
code = CharVal("弊")
See Also:
Asc() function, ChrU$() function, Character Code Table Definitions