Skip to content

$ZCHar()

$ZCHar()

Returns a string composed of bytes represented by the integer octet values specified in its argument(s).

The format for the $ZCHAR() function is:

$ZCH[AR](intexpr[,...])
  • The integer expression(s) specify the numeric byte value of the byte(s) $ZCHAR() returns.
  • GT.M limits the number of arguments to a maximum of 254. $ZCHAR() provides a means of producing byte sequences. In the UTF-8 mode, $ZCHAR() returns a malformed characters for numeric byte values 128 to 255. In the M mode, $ZCHAR() can create valid UTF-8 characters that includes bytes in the range 128-255.
    [Note]Note
    The output of $ZCHAR() 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 $ZCHAR() for values 128 through 255 differ for each character encoding scheme.
  • When used with $ZASCII(), $ZCHAR() can also perform arithmetic operations on the byte values of the bytes associated with a sequence of octets (8-bit bytes).

Example of $ZCHAR()

Example:

GTM>write $zchar(228,184,187,7)
主
GTM>

This example WRITEs the byte sequence represented by 主 and signals the terminal bell.