std::lconv
STD::Iconv
Defined in header | | |
---|---|---|
struct lconv; | | |
全班std::lconv
包含C语言环境定义的数字和货币格式规则。此结构的对象可以用std::localeconv
...成员std::lconv
是类型的值char
和类型char*
.每个char*
成员除外decimal_point
可能指向空字符%28,即空C-字符串%29。类型成员char
都是非负数,其中任何一个都可能是CHAR_MAX
如果对应的值在当前C语言环境中不可用。
成员对象
非货币数字格式参数
char* decimal_point | the character used as the decimal point (public member object) |
---|---|
char* thousands_sep | the character used to separate groups of digits before the decimal point (public member object) |
char* grouping | a string whose elements indicate the sizes of digit groups (public member object) |
货币数字格式参数
char* mon_decimal_point | the character used as the decimal point (public member object) |
---|---|
char* mon_thousands_sep | the character used to separate groups of digits before the decimal point (public member object) |
char* mon_grouping | a string whose elements indicate the sizes of digit groups (public member object) |
char* positive_sign | a string used to indicate non-negative monetary quantity (public member object) |
char* negative_sign | a string used to indicate negative monetary quantity (public member object) |
本地货币数字格式参数
char* currency_symbol | the symbol used for currency in the current C locale (public member object) |
---|---|
char frac_digits | the number of digits after the decimal point to display in a monetary quantity (public member object) |
char p_cs_precedes | 1 if currency_symbol is placed before non-negative value, 0 if after (public member object) |
char n_cs_precedes | 1 if currency_symbol is placed before negative value, 0 if after (public member object) |
char p_sep_by_space | indicates the separation of currency_symbol, positive_sign, and the non-negative monetary value (public member object) |
char n_sep_by_space | indicates the separation of currency_symbol, negative_sign, and the negative monetary value (public member object) |
char p_sign_posn | indicates the position of positive_sign in a non-negative monetary value (public member object) |
char n_sign_posn | indicates the position of negative_sign in a negative monetary value (public member object) |
国际货币数字格式参数
char* int_curr_symbol | the string used as international currency name in the current C locale (public member object) |
---|---|
char int_frac_digits | the number of digits after the decimal point to display in an international monetary quantity (public member object) |
char int_p_cs_precedes (C++11) | 1 if currency_symbol is placed before non-negative international monetary value, 0 if after (public member object) |
char int_n_cs_precedes (C++11) | 1 if currency_symbol is placed before negative international monetary value, 0 if after (public member object) |
char int_p_sep_by_space (C++11) | indicates the separation of currency_symbol, positive_sign, and the non-negative international monetary value (public member object) |
char int_n_sep_by_space (C++11) | indicates the separation of currency_symbol, negative_sign, and the negative international monetary value (public member object) |
char int_p_sign_posn (C++11) | indicates the position of positive_sign in a non-negative international monetary value (public member object) |
char int_n_sign_posn (C++11) | indicates the position of negative_sign in a negative international monetary value (public member object) |
所指向的C-字符串的字符。grouping
和mon_grouping
根据它们的数值进行解释。当终止'\0'
遇到时,最后看到的值将被假定为对剩余的数字重复。如果CHAR_MAX
遇到,则不会对其他数字进行分组。一次三位数的典型分组是"\003"
...
的价值p_sep_by_space
,,,n_sep_by_space
,,,int_p_sep_by_space
,,,int_n_sep_by_space
解释如下:
0 | no space separates the currency symbol and the value |
---|---|
1 | sign sticks to the currency symbol, value is separated by a space |
2 | sign sticks to the value. Currency symbol is separated by a space |
的价值p_sign_posn
,,,n_sign_posn
,,,int_p_sign_posn
,,,int_n_sign_posn
解释如下:
0 | parentheses around the value and the currency symbol are used to represent the sign |
---|---|
1 | sign before the value and the currency symbol |
2 | sign after the value and the currency symbol |
3 | sign before the currency symbol |
4 | sign after the currency symbol |
例
二次
#include <clocale>
#include <iostream>
int main()
{
std::setlocale(LC_ALL, "ja_JP.UTF-8"
std::lconv* lc = std::localeconv(
std::cout << "Japanese currency symbol: " << lc->currency_symbol
<< '(' << lc->int_curr_symbol << ")\n";
}
二次
产出:
二次
Japanese currency symbol: ¥(JPY )
二次
另见
localeconv | queries numeric and monetary formatting details of the current locale (function) |
---|---|
numpunct | defines numeric punctuation rules (class template) |
moneypunct | defines monetary formatting parameters used by std::money_get and std::money_put (class template) |
c国际康复会的文件
© cppreference.com
在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。