Returns a string of one or more characters corresponding to integer ASCII codes specified in its argument(s). For a process started in UTF-8 mode, $CHAR() returns a string composed of characters represented by the integer equivalents of the Unicode code-points specified in its argument(s).

The format for the $CHAR function is:


Examples of $CHAR()


GTM>write $char(77,85,77,80,83,7)

This example uses $CHAR() to WRITE the word MUMPS and signal the terminal "bell."


set nam=$extract(nam,1,$length(nam)-1)_$char($ascii(nam,$length(nam))-1)

This example uses $CHAR() and $ASCII() to set the variable nam to a value that immediately precedes its previous value in the set of strings of the same length as nam.


GTM>write $zchset
GTM>write $char(20027)

GTM>write $char(65)

In the above example, the integer value 20027 is the Unicode character "主" in the CJK Ideograph block of Unicode. Note that the output of the $CHAR() function for values of integer expression(s) from 0 through 127 does not vary with choice of the character encoding scheme. This is because 7-bit ASCII is a proper subset of UTF-8 character encoding scheme. The representation of characters returned by the $CHAR() function for values 128 through 255 differ for each character encoding scheme.