Locale-specific numeric formatting
The numeric-format functions require a format string as an argument.
Formatting character | Function |
---|---|
Dollar sign ($) | Currency symbol |
Comma (,) | Thousands separator |
Period (.) | Decimal separator |
- The symbols that DBMONEY indicates (if DBMONEY is
set)
For information about the locale-specific behavior of DBMONEY, see DBMONEY extensions.
- The symbols that the appropriate locale category of the client
locale (if CLIENT_LOCALE is set) specifies
If the format string contains either a $ or @ formatting character, a numeric-format function assumes that the value is a monetary value and refers to the MONETARY category of the client locale. If these two symbols are not in the format string, a numeric-format function refers to the NUMERIC category of the client locale.
For more information about the use of the $ and @ formatting characters, see ids_gug_236.html#ids_gug_236. For more information about the MONETARY and NUMERIC locale categories, see Locale categories.
- The actual symbol that appears in the format string ($, comma, or period)
These numeric-format functions replace the dollar sign in the format string with the currency symbol that DBMONEY specifies (if it is set) or with the currency symbol that the client locale specifies (if DBMONEY is not set).
stcopy("$***,***.&&", fmtbuf);
rfmtlong(78941, fmtbuf, outbuf);
printf("Formatted value: %s\n", outbuf);
78941.00
(if DBMONEY is
not set). Format string | Client locale | Formatted Value |
---|---|---|
$***,***.&& | Default locale (en_us.8859-1) | $*78,941.00 |
German locale (de_de.8859-1) | DM*78.941,00 | |
Spanish locale (es_es.8859-1) | Pts*78.941,00 |
In the default locale, this code
fragment produces the following result for the logical MONEY value
of 78941.00
(if DBMONEY is not
set): $*78,941.00