Product Site

5.1.7.58. d2x

Returns a string, in character format, that represents the receiving string, a decimal number converted to hexadecimal. The returned string uses uppercase alphabetic characters for the values A-F and does not include whitespace.

The receiving string must not have more digits than the current setting of NUMERIC DIGITS.

If you specify n, it is the length of the final result in characters. After conversion the returned string is sign-extended to the required length. If the number is too big to fit into n characters, it is truncated on the left. If you specify n, it must be a positive whole number or zero.

If you omit n, the receiving string must be a positive whole number or zero, and the returned result has no leading zeros.
Example 5.96. String class — d2x method
"9"~d2x        -->    "9"
"129"~d2x      -->    "81"
"129"~d2x(1)   -->    "1"
"129"~d2x(2)   -->    "81"
"129"~d2x(4)   -->    "0081"
"257"~d2x(2)   -->    "01"
"-127"~d2x(2)  -->    "81"
"-127"~d2x(4)  -->    "FF81"
"12"~d2x(0)    -->    ""