std::lconv
来自cppreference.com
|
|
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
| 在头文件 <clocale> 中定义
|
||
| struct lconv; |
||
类
std::lconv包含数字和货币格式规则所定义的一个C语言环境。这个结构的对象可以得到std::localeconv。 std::lconv类型char和char*类型的值。每个char*成员除了decimal_point可能指向一个空字符(即,在一个空的C-字符串)。 char的成员的类型都是非负数,这可能是任何CHAR_MAX相应的值是在当前的C语言环境.原文:
The class
std::lconv contains numeric and monetary formatting rules as defined by a C locale. Objects of this struct may be obtained with std::localeconv. The members of std::lconv are values of type char and of type char*. Each char* member except decimal_point may be pointing at a null character (that is, at an empty C-string). The members of type char are all non-negative numbers, any of which may be CHAR_MAX if the corresponding value is not available in the current C locale.目录 |
[编辑] 会员对象
[编辑] 非货币数字格式的参数
| char* decimal_point |
字符作为小数点 原文: the character used as the decimal point (公共成员对象) |
| char* thousands_sep |
分开多组数字的小数点前的字符 原文: the character used to separate groups of digits before the decimal point (公共成员对象) |
| char* grouping |
一个字符串,它表示数字组的大小的元素 原文: a string whose elements indicate the sizes of digit groups (公共成员对象) |
[编辑] 货币数字格式的参数
| char* mon_decimal_point |
字符作为小数点 原文: the character used as the decimal point (公共成员对象) |
| char* mon_thousands_sep |
分开多组数字的小数点前的字符 原文: the character used to separate groups of digits before the decimal point (公共成员对象) |
| char* mon_grouping |
一个字符串,它表示数字组的大小的元素 原文: a string whose elements indicate the sizes of digit groups (公共成员对象) |
| char* positive_sign |
使用一个字符串来表示非负的货币数量 原文: a string used to indicate non-negative monetary quantity (公共成员对象) |
| char* negative_sign |
一个字符串,用于指示负货币数量 原文: a string used to indicate negative monetary quantity (公共成员对象) |
[编辑] 本地货币数字格式的参数
| char* currency_symbol |
在当前的C语言环境中使用的符号货币 原文: the symbol used for currency in the current C locale (公共成员对象) |
| char frac_digits |
小数点后的数字位数显示的货币数量 原文: the number of digits after the decimal point to display in a monetary quantity (公共成员对象) |
| char p_cs_precedes |
1如果CURRENCY_SYMBOL,是摆在非负值,0如果以后 原文: 1 if currency_symbol is placed before non-negative value, 0 if after (公共成员对象) |
| char n_cs_precedes |
1如果CURRENCY_SYMBOL负值,是摆在0如果以后 原文: 1 if currency_symbol is placed before negative value, 0 if after (公共成员对象) |
| char p_sep_by_space |
指示分离的 currency_symbol,positive_sign,和非负的货币值原文: indicates the separation of currency_symbol, positive_sign, and the non-negative monetary value(公共成员对象) |
| char n_sep_by_space |
指示分离的 currency_symbol,negative_sign,和负的货币价值原文: indicates the separation of currency_symbol, negative_sign, and the negative monetary value(公共成员对象) |
| char p_sign_posn |
表示位置 positive_sign在一个非负的货币值原文: indicates the position of positive_sign in a non-negative monetary value(公共成员对象) |
| char n_sign_posn |
指示的位置在一个负的货币价值 negative_sign原文: indicates the position of negative_sign in a negative monetary value(公共成员对象) |
[编辑] 国际货币数字格式的参数
| char* int_curr_symbol |
作为国际货币的名称在当前的C语言环境中使用的字符串 原文: the string used as international currency name in the current C locale (公共成员对象) |
| char int_frac_digits |
数小数点后的数字显示,在国际货币数量 原文: the number of digits after the decimal point to display in an international monetary quantity (公共成员对象) |
| char int_p_cs_precedes |
1如果CURRENCY_SYMBOL,是摆在国际货币值非负,0如果以后 原文: 1 if currency_symbol is placed before non-negative international monetary value, 0 if after (公共成员对象) |
| char int_n_cs_precedes |
1如果CURRENCY_SYMBOL负面的国际货币价值,是摆在0如果以后 原文: 1 if currency_symbol is placed before negative international monetary value, 0 if after (公共成员对象) |
| char int_p_sep_by_space |
表示分离的 currency_symbol,positive_sign,和国际货币值的非负原文: indicates the separation of currency_symbol, positive_sign, and the non-negative international monetary value(公共成员对象) |
| char int_n_sep_by_space |
表示分离的 currency_symbol,negative_sign,并且负的国际货币值原文: indicates the separation of currency_symbol, negative_sign, and the negative international monetary value(公共成员对象) |
| char int_p_sign_posn |
表示 positive_sign在一个非负的国际货币值的位置原文: indicates the position of positive_sign in a non-negative international monetary value(公共成员对象) |
| char int_n_sign_posn |
表示 negative_sign以一种消极的国际货币值的位置原文: indicates the position of negative_sign in a negative international monetary value(公共成员对象) |
的C-字符串的字符所指向
grouping和mon_grouping根据其数值被解释。当终止'\0'遇到的最后一个值所见的假定重复的剩余位数。如果遇到CHAR_MAX,没有进一步的数字进行分组。典型的一次是三个数字分组"\003".原文:
The characters of the C-strings pointed to by
grouping and mon_grouping are interpreted according to their numeric values. When the terminating '\0' is encountered, the last value seen is assumed to repeat for the remainder of digits. If CHAR_MAX is encountered, no further digits are grouped. the typical grouping of three digits at a time is "\003".值
p_sep_by_space,n_sep_by_space,int_p_sep_by_space,int_n_sep_by_space解释如下:原文:
The values of
p_sep_by_space, n_sep_by_space, int_p_sep_by_space, int_n_sep_by_space are interpreted as follows:| 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解释如下:原文:
The values of
p_sign_posn, n_sign_posn, int_p_sign_posn, int_n_sign_posn are interpreted as follows:| 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 | 前签署的货币符号
|
| 4 | 签署后的货币符号
|
[编辑] 示例
#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 )
[编辑] 另请参阅
| 查询当前语言环境的数字和货币格式的详细信息 原文: queries numeric and monetary formatting details of the current locale (函数) | |
| 定义数字标点规则 (类模板) | |
| 定义货币格式std::money_get和std::money_put使用的参数 原文: defines monetary formatting parameters used by std::money_get and std::money_put (类模板) | |
| C documentation for lconv
| |