Home  /  Application Development: Core Topics  /  ObjectScript Reference  /  ObjectScript Functions  /  $ZQASCII

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

Converts an eight-byte string to a number.
string A string. It can be a value, a variable, or an expression. It must be a minimum of eight bytes in length.
position Optional — A starting position in the string, expressed as a positive integer. The default is 1. Position is counted in single bytes, not eight-byte strings. The position cannot be the last byte in the string, or beyond the end of the string. A numeric position value is parsed as an integer by truncating decimal digits, removing leading zeros and plus signs, etc.
The value that $ZQASCII returns depends on the parameters you use.
$ZQASCII can return either a positive or a negative integer.
$ZQASCII issues a <FUNCTION> error if string is of an invalid length, or position is an invalid value.
The following example determines the numeric interpretation of the character string "abcdefgh":
  WRITE $ZQASCII("abcdefgh")
It returns 7523094288207667809.
The following examples also return 7523094288207667809:
  WRITE !,$ZQASCII("abcdefgh",1)
  WRITE !,$ZQASCII("abcdefghxx",1)
  WRITE !,$ZQASCII("xxabcdefghxx",3)
$ZQASCII is similar to $ASCII except that it operates on eight byte (64-bit) words instead of single 8-bit bytes. For 16-bit words use $ZWASCII; for 32-bit words, use $ZLASCII.
The $ZQCHAR function is the logical inverse of $ZQASCII. For example:
   WRITE $ZQASCII("abcdefgh")
returns: 7523094288207667809.
   WRITE $ZQCHAR(7523094288207667809)
returns “abcdefgh”.
See Also