Skip to main content

$ZLCHAR

Converts a number to a four-byte string.

Synopsis

$ZLCHAR(n)
$ZLC(n)

Parameter

Argument Description
n A positive integer in the range 0 through 4294967295. It can be specified as a value, a variable, or an expression.

Description

$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.

Notes

$ZLASCII and $ZLCHAR

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 and $CHAR

$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

FeedbackOpens in a new tab