These are the standard members of struct lconv
; there may be others.
char *decimal_point
char *mon_decimal_point
decimal_point
is "."
, and the value of mon_decimal_point
is ""
.
char *thousands_sep
char *mon_thousands_sep
""
(the empty string).
char *grouping
char *mon_grouping
grouping
applies to non-monetary quantities and mon_grouping
applies to monetary quantities. Use either thousands_sep
or mon_thousands_sep
to separate the digit groups. Each string is made up of decimal numbers separated by semicolons. Successive numbers (from left to right) give the sizes of successive groups (from right to left, starting at the decimal point). The last number in the string is used over and over for all the remaining groups.
If the last integer is -1
, it means that there is no more grouping---or, put another way, any remaining digits form one large group without separators.
For example, if grouping
is "4;3;2"
, the correct grouping for the number 123456787654321
is `12', `34', `56', `78', `765', `4321'. This uses a group of 4 digits at the end, preceded by a group of 3 digits, preceded by groups of 2 digits (as many as needed). With a separator of `,', the number would be printed as `12,34,56,78,765,4321'.
A value of "3"
indicates repeated groups of three digits, as normally used in the U.S.
In the standard `C' locale, both grouping
and mon_grouping
have a value of ""
. This value specifies no grouping at all.
char int_frac_digits
char frac_digits
In the standard `C' locale, both of these members have the value CHAR_MAX
, meaning ``unspecified''. The ANSI standard doesn't say what to do when you find this the value; we recommend printing no fractional digits. (This locale also specifies the empty string for mon_decimal_point
, so printing any fractional digits would be confusing!)