• C++ Reference: Standard C++ Library reference: C Library: clocale: struct lconv


    C++官网参考链接:https://cplusplus.com/reference/clocale/lconv/

    类型 

    struct lconv
    struct lconv;

    数值的格式化信息
    该结构保存关于如何书写数值(货币值和非货币值)的格式化信息。
    函数localeconv返回这种类型的对象。
    它包含以下成员(不一定以下面表中的顺序):

    成员常量 

    membertypevalue in "C" localedescription
    decimal_pointchar*"."

    Decimal-point separator used for non-monetary quantities.

    (用于非货币量的小数点分隔符。)

    thousands_sepchar*""

    Separators used to delimit groups of digits to the left of the decimal point for non-monetary quantities.

    (用于分隔非货币量小数点左侧的数字组的分隔符。)

    groupingchar*""

    Specifies the amount of digits that form each of the groups to be separated by thousands_sep separator for non-monetary quantities. This is a zero-terminated sequence of char values that may contain different grouping sizes for each successive group starting from the right, each number indicating the amount of digits for the group; the last number before the ending zero in this string is used for the remaining groups. For example, assuming thousand_sep is set to "," and the number to represent is one million (1000000):
    with grouping set to "\3", the number would be represented as: 1,000,000
    with grouping set to "\1\2\3", the number would be represented as: 1,000,00,0
    with grouping set to "\3\1", the number would be represented as: 1,0,0,0,000
    CHAR_MAX indicates that no further grouping is to be performed.

    (对于非货币量,指定构成每个组的数字量,这些组将由thousands_sep分隔符分隔。这是一个以0终止的char值序列,从右开始的每个连续组可能包含不同的组大小,每个数字表示组的数字数量;此字符串中结束0之前的最后一个数字用于其余组。例如,

    假设thousand_sep设为",",表示的数字是一百万(1000000):

    如果分组设置为“\3”,则数字将表示为:1,000,000

    如果分组设置为“\1\2\3”,则数字将表示为:1000,00,0

    如果分组设置为“\3\1”,则数字将表示为:1,0,0,0,000

    CHAR_MAX表示不再进行分组。)

    int_curr_symbolchar*""

    International currency symbol. This is formed by the three-letter ISO-4217 entry code for the currency, like "USD" for U.S.-Dollar or "GBP" for Pound Sterling, followed by the character used to separate this symbol from the monetary quantity

    (国际货币符号。这是由三字母的ISO-4217输入代码组成的,就像“USD”代表美元,“GBP”代表英镑,后面跟着用来将该符号与货币量分隔开的字符)

    currency_symbolchar*""

    Local currency symbol, like "$".

    (本地货币符号,如“$”。)

    mon_decimal_pointchar*""

    Decimal-point separator used for monetary quantities.

    (用于货币量的小数点分隔符。)

    mon_thousands_sepchar*""

    Separators used to delimit groups of digits to the left of the decimal point for monetary quantities.

    (对于货币量,该分隔符用于分隔小数点左侧的数字组。)

    mon_groupingchar*""

    Specifies the amount of digits that form each of the groups to be separated by mon_thousands_sep separator for monetary quantities. See grouping description above.

    (指定组成每个组的数字数量,用mon_thousands_sep分隔符分隔货币量。参考上面的grouping说明。)

    positive_signchar*""

    Sign to be used for nonnegative (positive or zero) monetary quantities.

    (用于非负(正或零)货币量的符号。)

    negative_signchar*""

    Sign to be used for negative monetary quantities.

    (用于负货币量的符号。)

    frac_digitscharCHAR_MAX

    Amount of fractional digits to the right of the decimal point for monetary quantities in the local format.

    (本地格式的货币量的小数点右边的小数位数。)

    p_cs_precedescharCHAR_MAX

    Whether the currency symbol should precede nonnegative (positive or zero) monetary quantities. If this value is 1, the currency symbol should precede; if it is 0, it should follow.

    (货币符号是否应位于非负(正或零)货币量之前。如果该值为1,则货币符号应该在前面;如果它是0,它应该在后面。)

    n_cs_precedescharCHAR_MAX

    Whether the currency symbol should precede negative monetary quantities. If this value is 1, the currency symbol should precede; if it is 0 it should follow.

    (货币符号是否应位于负货币量之前。如果该值为1,则货币符号应该在前面;如果它是0,它应该在后面。)

    p_sep_by_spacecharCHAR_MAX

    Whether a space should appear between the currency symbol and nonnegative (positive or zero) monetary quantities. If this value is 1, a space should appear; if it is 0 it should not.

    (货币符号与非负(正或零)货币量之间是否应出现空白。如果该值为1,则应该出现空白;如果是0,就不应该出现空白。)

    n_sep_by_spacecharCHAR_MAX

    Whether a space should appear between the currency symbol and negative monetary quantities. If this value is 1, a space should appear; if it is 0 it should not.

    (货币符号与负货币量之间是否应出现空白。如果该值为1,则应该出现空白;如果是0,就不应该出现空白。)

    p_sign_posncharCHAR_MAX

    Position of the sign for nonnegative (positive or zero) monetary quantities:
    0 : Currency symbol and quantity surrounded by parentheses.
    1 : Sign before the quantity and currency symbol.
    2 : Sign after the quantity and currency symbol.
    3 : Sign right before currency symbol.
    4 : Sign right after currency symbol.
    CHAR_MAX : Unspecified.

    (非负(正或零)货币量的符号位置:

    0:货币符号和用圆括号括起来的货币量。

    1:在货币量和货币符号前标记。

    2:在货币量和货币符号后标记。

    3:在货币符号前面标记。

    4:在货币符号后面标记。

    CHAR_MAX:未指定。)

    n_sign_posncharCHAR_MAX

    Position of the sign for negative monetary quantities. See p_sign_posn above.

    (负货币量的符号位置。参考上面的p_sign_posn。)

    int_frac_digitscharCHAR_MAX

    Same as frac_digits, but for the international format (instead of the local format).

    (与frac_digits相同,但用于国际格式(而不是本地格式)。)

    int_p_cs_precedescharCHAR_MAX

    Same as p_cs_precedes, but for the international format.

    (与p_cs_precedes相同,但用于国际格式。)

    int_n_cs_precedescharCHAR_MAX

    Same as n_cs_precedes, but for the international format.

    (与n_cs_precedes相同,但用于国际格式。)

    int_p_sep_by_spacecharCHAR_MAX

    Same as p_sep_by_space, but for the international format.

    (与p_sep_by_space相同,但用于国际格式。)

    int_n_sep_by_spacecharCHAR_MAX

    Same as n_sep_by_space, but for the international format.

    (与n_sep_by_space相同,但用于国际格式。)

    int_p_sign_posncharCHAR_MAX

    Same as p_sign_posn, but for the international format.

    (与p_sign_posn相同,但用于国际格式。)

    int_n_sign_posncharCHAR_MAX

    Same as n_sign_posn, but for the international format.

    (与n_sign_posn相同,但用于国际格式。)

    对于char*类型的成员,值为"";或对于char类型的成员,值为CHAR_MAX表示该值在语言环境设置中不可用。

    兼容性
    以int_p和int_n(上面黄色部分)开头的成员是为符合1999年或更高版本C标准的库定义的(只有2011年以后的C++标准才要求:C++11)。

  • 相关阅读:
    MySQL进阶篇(3)—锁、InnoDB引擎
    pom.xml
    Gitee + Drone CI搭建自动集成平台出现报错
    简单学习GoogleColab的入门级概念
    标准应用 | 数据库防火墙安全技术解析与实践
    责任链模式让我的代码精简10倍?
    123. 使用 Busy Dialog 动画阻止 SAP UI5 应用按钮短时间内快速被点击
    用新服务器从零开始部署 DolphinDB
    【对比Java学Kotlin】协程简史
    LeetCode--102. 二叉树的层序遍历(C++描述)
  • 原文地址:https://blog.csdn.net/weixin_40186813/article/details/127024353