Product SiteDocumentation Site

7.4.21. D2C (Decimal to Character)


>>-D2C(wholenumber--+----+--)----------------------------------><
                    +-,n-+

Returns a string, in character format, that is the ASCII representation of the decimal number. If you specify n, it is the length of the final result in characters; leading "00"x (for a positive wholenumber) or "FF"x (for a negative wholenumber) characters are added to the result string as necessary. n must be a positive whole number or zero.
Wholenumber must not have more digits than the current setting of NUMERIC DIGITS.
If you omit n, wholenumber must be a positive whole number or zero, and the result length is as needed. Therefore, the returned result has no leading "00"x characters.
Here are some examples:

Example 7.28. Builtin function D2C

D2C(65)      ->   "A"      /* "41"x is an ASCII "A"               */
D2C(65,1)    ->   "A"
D2C(65,2)    ->   " A"     /* the leading character is a "00"x    */
D2C(65,5)    ->   "    A"  /* the leading characters are "00"x    */
D2C(109)     ->   "m"      /* "6D"x  is an ASCII "m"              */
D2C(-109,1)  ->   "ô"      /* "93"x is an ASCII "ô"   */
D2C(76,2)    ->   " L"     /* "4C"x  is an ASCII "L"              */
D2C(-180,2)  ->   " L"     /* the leading character is a "FF"x    */