$ZDASCII (ObjectScript)
Synopsis
$ZDASCII(string,position)
$ZDA(string,position)
Arguments
Argument | Description |
---|---|
string | A string or number. It can be a value, a variable, or an expression. It must be a minimum of eight bytes in length. A number is converted to canonical form by removing a leading plus sign, and leading and trailing zeros before it is supplied to $ZDASCII; the resulting canonical number must be a minimum of eight bytes in length. |
position | Optional — A starting position in the string, expressed as a positive, non-zero integer. The default is 1. Position is counted in single bytes, not eight-byte strings. There must exist at least eight bytes of string from the specified position (inclusive). A numeric position value is parsed as an integer by truncating decimal digits, removing leading zeros and plus signs, etc. |
Description
The value that $ZDASCII returns depends on the arguments you use.
-
$ZDASCII(string) returns a $DOUBLE (IEEE floating point) numeric interpretation of an eight-byte string starting at the first character position of string.
-
$ZDASCII(string,position) returns a $DOUBLE (IEEE floating point) numeric interpretation of an eight-byte string beginning at the starting byte position specified by position.
$ZDASCII can return either a positive or a negative number.
$ZDASCII issues a <FUNCTION> error if string is less than eight bytes in length, if the specified position results in a remaining string of less than eight bytes, or if position is an invalid value.
Examples
The following example determines the numeric interpretation of the numeric 12345678:
WRITE $ZDASCII(12345678)
It returns: .000000000000000000000000000000000000068213200517013251261
The following examples also return the same value:
WRITE !,$ZDASCII("12345678",1)
WRITE !,$ZDASCII(++001234567899,1)
WRITE !,$ZDASCII("++001234567899",5)
The following example determines the numeric interpretation of the negative numeric –1234567. Note that the minus sign is counted as a byte:
WRITE $ZDASCII(-1234567)
It returns: .00000000000000000000000000000000000000000099583343788967399388
The following example determines the numeric interpretation of the character string “abcdefgh”:
WRITE $ZDASCII("abcdefgh")
It returns: 85408832230361244356000000000000000000000000000000000000000000000000000
$ZDASCII and Other $ASCII Functions
$ZDASCII converts a eight byte (64-bit) character string to an IEEE floating point number. $ZQASCII converts a eight byte (64-bit) character string to an integer. To convert an 8-bit byte string to an integer use $ASCII. To convert a 16-bit (wide) character string to an integer use $ZWASCII. To convert a 32-bit (long) character string to an integer use $ZLASCII.