Currency-symbol formatting
The IBM® Informix® ESQL/C numeric-format functions support all formatting characters that the IBM Informix ESQL/C Programmer's Manual describes.
Formatting character | Function |
---|---|
$ | This character is replaced by the front currency symbol if the locale defines one. The MONETARY category of the locale defines the front currency symbol, which is the symbol that appears before a monetary value. When you group several dollar signs in a row, a single currency symbol floats to the rightmost position that it can occupy without interfering with the number. |
@ | This character is replaced by the back currency symbol if the locale defines one. The MONETARY category of the locale defines the back currency symbol, the symbol that appears after a monetary value. |
For more information, see The MONETARY category.
- If the locale formats monetary values with a currency symbol before the value, the locale sets the currency symbol to the front currency symbol and sets the back currency symbol to a blank character.
- If the locale formats monetary values with a currency symbol after the value, the locale sets the currency symbol to the back currency symbol and sets the front currency symbol to a blank character.
The default locale defines the currency symbol as the front currency symbol, which appears as a dollar sign ($). In the default locale, the back currency symbol appears as a blank space. In the default, British, and French locales, the numeric-format functions produce the following results for the internal MONEY value of 1.00.
Format string | Client locale | Formatted result |
---|---|---|
$***,*** | Default locale (en_us.8859-1) |
$******1 |
$***,***@ | Default locale (en_us.8859-1) |
$******1s |
$$,$$$.$$ | Default locale (en_us.8859-1) |
ssss$1.00 |
***,***@ | Default locale (en_us.8859-1) |
******1s |
@***,*** | Default locale (en_us.8859-1) |
s******1 |
In the preceding table, the character s represents a blank or space, € is the currency symbol for Euros, and £ is the British currency symbol for pounds Sterling.
The DBMONEY environment variable can also set the precede-currency symbol and the succeed-currency symbol. The syntax diagram in DBMONEY environment variable refers to these symbols as front and back. The DBMONEY setting, if one is specified, takes precedence over the symbols that the MONETARY category of the locale defines.