$ASCII()

Returns the integer ASCII code for a character in the given string. For a mumps process started in UTF-8 mode, $ASCII() returns the integer Unicode® UTF-8 code-point value of a character in the given string.

The format for the $ASCII function is:

$A[SCII](expr[,intexpr])

$ASCII() provides a means of examining non-graphic characters in a string. When used with $CHAR(), $ASCII() also provides a means to perform arithmetic operations on the codes associated with characters.

$ZASCII() is the parallel function of $ASCII(). $ZASCII() interprets the string argument as a sequence of bytes (rather than a sequence of characters) and can perform all byte-oriented $ASCII() operations. For more information, refer to “$ZAscii()”.

Examples of $ASCII()

Example:

GTM>For i=0:1:3 Write !,$Ascii("Hi",i)
-1
72
73
-1
GTM>

This loop displays the result of $ASCII() specifying a character position before, first and second positions, and after the string.

Example:

GTM>Write $ZCHSET
UTF-8
GTM>Write $Ascii("")
20027
GTM>Write $$FUNC^%DH("20027")
00004E3B

In this example, 20027 is the integer equivalent of the hexadecimal value 4E3B. U+4E3B is a character in the CJK Ideograph block of the Unicode® standard.