InterSystems IRIS Data Platform 2019.2  /  ObjectScript Reference  /  ObjectScript Functions

ObjectScript Reference
Previous section           Next section
InterSystems: The power behind what matters   

Converts a number to a two-byte string.
n A positive integer in the range 0 through 65535. It can be specified as a value, a variable, or an expression.
$ZWCHAR returns a two-byte (wide) character string corresponding to the binary representation of n. The bytes of the character string are presented in little-endian byte order, with the least significant byte first. It is the functional equivalent of:
   WRITE $CHAR(n#256,n\256)
If n is out of range or a negative number, $ZWCHAR returns the null string.
The following example returns the two-byte string for the integer 25185:
   WRITE $ZWCHAR(25185)
returns: ab
$ZWCHAR is similar to $CHAR except that it operates on two byte (16-bit) words instead of single 8-bit bytes. For four byte (32-bit) words, use $ZLCHAR; For eight byte (64-bit) words, use $ZQCHAR.
$ZWASCII is the logical inverse of the $ZWCHAR function. For example:
   WRITE $ZWCHAR(25185)
returns: ab
returns: 25185
See Also

Previous section           Next section
Send us comments on this page
View this book as PDF   |  Download all PDFs
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA
Content Date/Time: 2019-10-18 06:48:42