![]() |
|
A numeric-formatting mask specifies a format to apply to some numeric value. This mask is a combination of the following formatting characters:
Any other characters in the formatting mask are reproduced literally in the result.
When you use the following characters within a formatting mask, the characters float; that is, multiple occurrences of the character at the left of the pattern in the mask appear as a single character as far to the right as possible in the formatted number (without removing significant digits):
For example, if you apply the mask $$$,$$$.## to the number 1234.56, the result is $1,234.56.
When you use rfmtdec(), rfmtdouble(), or rfmtlong() to format MONEY values, the function uses the currency symbols that the DBMONEY environment variable specifies. If you do not set this environment variable, the numeric-formatting functions use the currency symbols that the client locale defines. The default local, U.S. English, defines currency symbols as if you set DBMONEY to "$,.". For a discussion of DBMONEY, see the Informix Guide to SQL: Reference. For more information on locales, see the Informix Guide to GLS Functionality.
Figure 5-4 on page 5-18 shows sample format strings for numeric expressions. The character b represents a blank or space.
Figure 5-4
INFORMIX-ESQL/C provides special functions that allow you to format numeric expressions for display. These formatting functions apply a given formatting mask to a numeric value to allow you to line up decimal points, right- or left-justify the number, enclose a negative number in parentheses, and so on. The ESQL/C library includes the following functions that support formatting masks for numeric values.
For information on the syntax and behavior of these library functions, refer to Appendix B, ESQL/C Function Library.