Caché ObjectScript Reference
[Home] [Back] [Next]
InterSystems: The power behind what matters   

Converts a number to a four-byte string.
n A positive integer in the range 0 through 4294967295. It can be specified as a value, a variable, or an expression.
$ZLCHAR returns a four-byte (long) character string for n. The bytes of the character string are presented in little-endian byte order, with the least significant byte first.
If n is out of range or a negative number, $ZLCHAR returns the null string.
The $ZLASCII function is the logical inverse of $ZLCHAR. For example:
   SET x=$ZLASCII("abcd")
   WRITE !,x
   SET y=$ZLCHAR(x)
   WRITE !,y
Given “abcd” $ZLASCII returns 1684234849. Given 1684234849 $ZLCHAR returns “abcd”.
$ZLCHAR is similar to $CHAR, except that it operates on four byte (32-bit) words instead of single 8-bit bytes. For two byte (16-bit) words use $ZWASCII; for eight byte (64-bit) words, use $ZQASCII.
$ZLCHAR is the functional equivalent of the following form of $CHAR:
   SET n=$ZLASCII("abcd")
   WRITE !,n
   WRITE !,$CHAR(n#256,n\256#256,n\(256**2)#256,n\(256**3))
Given “abcd” $ZLASCII returns 1684234849. Given 1684234849, this $CHAR statement returns “abcd”.
See Also

Send us comments on this page
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA