Skip to main content

$ZLASCII (ObjectScript)

Converts a four-byte string to a number.




Argument Description
string A string that can be specified as a value, a variable, or an expression. It must be a minimum of four bytes in length.
position Optional — A starting position in the string. The default is 1.


The value $ZLASCII returns depends on the arguments you use.

  • $ZLASCII(string) returns a numeric interpretation of a four-byte string, starting with the first character position of string.

  • $ZLASCII(string,position) returns a numeric interpretation of a four-byte string beginning at the starting position specified by position.

Upon successful completion, $ZLASCII always returns a positive integer. $ZLASCII returns -1 if string is of an invalid length, or position is an invalid value.


$ZLASCII is similar to $ASCII 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.

$ZLASCII(string,position) is the functional equivalent of:

$ASCII(string,position+3)*256 + $ASCII(string,position+2)*256 + $ASCII(string,position+1)*256 + $ASCII(string,position)


The $ZLCHAR function is the logical inverse of the $ZLASCII function. For example:

   SET x=$ZLASCII("abcd")
   WRITE !,x
   SET y=$ZLCHAR(x)
   WRITE !,y

Given “abcd” $ZLASCII returns 1684234849. Given 1684234849 $ZLCHAR returns “abcd”.

See Also

FeedbackOpens in a new tab