Survey Tabulation > Advanced expressions > UNICOM Intelligence function library > Text functions > AscW
 
AscW
Returns an integer value representing the Unicode character code (sometimes called the code point) for a character.
Syntax
AscW(Val)
Parameters
Val
Type: Text
Text value.
(return)
Type: Long
Unicode character code for first character of Val.
Remarks
A Unicode character code is an integer from 0 to 65535.
This function returns 0 if Val is empty. If the current data value is NULL, Val is an empty string and 0 is returned.
How you specify a text string as an argument depends on whether you are using the function in an SQL query or in mrScriptBasic or mrScriptMetadata. In an SQL query, enclose text strings in single quotation marks (' '). In mrScriptBasic or mrScriptMetadata, enclose text strings in double quotation marks (" ").
Example
This mrScriptBasic example uses the AscW function to return the character code for a single character:
AscW("a")
The return value is 97.
The next example shows an SQL query that uses the AscW function to return the character code for the first character of the name variable (which stores the respondent's name).
SELECT AscW(name) FROM vdata
See also
Text functions