当前位置: 首页 > news >正文

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

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

类型 
<clocale>
struct lconv
struct lconv;

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

成员常量 

membertypevalue in "C" localedescription
decimal_point(小数点)char*"."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.(对于非货币量,指定构成每个组的数字量,这些组将由thousands_sep分隔符分隔。)
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分隔符分隔。这是一个以零结尾的字符值序列,从右开始的每个连续组可能包含不同的组大小,每个数字表示组的数字数量;此字符串中结束零之前的最后一个数字用于其余组。例如,

假设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分隔符分隔货币量。参见上面的分组说明。)
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_MAXAmount 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_MAXWhether 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_MAXWhether 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_MAXPosition of the sign for negative monetary quantities. See p_sign_posn above.(负数货币数量的符号位置。参见上面的p_sign_posn。)
int_frac_digitscharCHAR_MAXSame as frac_digits, but for the international format (instead of the local format).(与frac_digits相同,但用于国际格式(而不是本地格式)。)
int_p_cs_precedescharCHAR_MAXSame as p_cs_precedes, but for the international format.(与p_cs_precedes相同,但用于国际格式。)
int_n_cs_precedescharCHAR_MAXSame as n_cs_precedes, but for the international format.(与n_cs_precedes相同,但用于国际格式。)
int_p_sep_by_spacecharCHAR_MAXSame as p_sep_by_space, but for the international format.(与p_sep_by_space相同,但适用于国际格式。)
int_n_sep_by_spacecharCHAR_MAXSame as n_sep_by_space, but for the international format.(与n_sep_by_space相同,但适用于国际格式。)
int_p_sign_posncharCHAR_MAXSame as p_sign_posn, but for the international format.(与p_sign_posn相同,但用于国际格式。)
int_n_sign_posncharCHAR_MAXSame 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)。

相关文章:

  • JavaSE进阶--集合(2万字总结)
  • CKA考题 [k8s1.21]
  • AcWing第 70 场周赛题解
  • 读FFA-net: Feature Fusion Attention Network for Single Image Dehazing
  • 测试需求平台4-Flask实现API服务入门实战
  • js单行代码-----dom
  • 模型压缩常用方法简介
  • css常用属性
  • 【Android】Android Binder进程间通信AIDL示例与过程分析
  • C#教程 - 模式匹配(Pattern matching)
  • 动手学习深度学习 05:深度学习计算
  • 状体模式-优雅解决物流状态
  • CTF之加密解密训练
  • gnome-terminal用法解析
  • ceres优化库的使用
  • JavaScript-如何实现克隆(clone)函数
  • [微信小程序] 使用ES6特性Class后出现编译异常
  • AHK 中 = 和 == 等比较运算符的用法
  • C++类中的特殊成员函数
  • Create React App 使用
  • DataBase in Android
  • Gradle 5.0 正式版发布
  • httpie使用详解
  • Java,console输出实时的转向GUI textbox
  • oschina
  • SpringBoot 实战 (三) | 配置文件详解
  • SpriteKit 技巧之添加背景图片
  • vagrant 添加本地 box 安装 laravel homestead
  • 动手做个聊天室,前端工程师百无聊赖的人生
  • 复习Javascript专题(四):js中的深浅拷贝
  • 构建工具 - 收藏集 - 掘金
  • 什么软件可以剪辑音乐?
  • 通过来模仿稀土掘金个人页面的布局来学习使用CoordinatorLayout
  • 微信端页面使用-webkit-box和绝对定位时,元素上移的问题
  • 延迟脚本的方式
  • 一个6年java程序员的工作感悟,写给还在迷茫的你
  • 关于Kubernetes Dashboard漏洞CVE-2018-18264的修复公告
  • 积累各种好的链接
  • 教程:使用iPhone相机和openCV来完成3D重建(第一部分) ...
  • ​直流电和交流电有什么区别为什么这个时候又要变成直流电呢?交流转换到直流(整流器)直流变交流(逆变器)​
  • $.type 怎么精确判断对象类型的 --(源码学习2)
  • (android 地图实战开发)3 在地图上显示当前位置和自定义银行位置
  • (C语言)输入自定义个数的整数,打印出最大值和最小值
  • (JS基础)String 类型
  • (八)c52学习之旅-中断实验
  • (板子)A* astar算法,AcWing第k短路+八数码 带注释
  • (二)Eureka服务搭建,服务注册,服务发现
  • (论文阅读32/100)Flowing convnets for human pose estimation in videos
  • (深入.Net平台的软件系统分层开发).第一章.上机练习.20170424
  • (四)c52学习之旅-流水LED灯
  • (一)硬件制作--从零开始自制linux掌上电脑(F1C200S) <嵌入式项目>
  • (转)linux 命令大全
  • (转)自己动手搭建Nginx+memcache+xdebug+php运行环境绿色版 For windows版
  • .htaccess 强制https 单独排除某个目录
  • .NET/C# 使用 SpanT 为字符串处理提升性能