首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

std::moneypunct::curr_symbol

Defined in header <locale>

?

?

public: string_type curr_symbol() const;

(1)

?

protected: virtual string_type do_curr_symbol() const;

(2)

?

1%29公共成员函数,调用成员函数do_curr_symbol最派生的类。

2%29返回此区域设置用作货币标识符的字符串。如果International%28的第二个模板参数std::moneypunct%29是false,标识符通常是单个%28宽的%29字符,如"¥""$".如果Internationaltrue,标识符通常是一个包含三个字符的国际货币代码的四个字符字符串,后面是空格%28。"JPY ""USD "%29

返回值

类型对象string_type持有货币符号或代码。

二次

代码语言:javascript
复制
#include <iostream>
#include <locale>
void show_ccy(const char* locname)
{
    std::locale loc(locname);
    std::cout << locname << " currency symbol is "
              << std::use_facet<std::moneypunct<char, true>>(loc).curr_symbol()
              << "or " << std::use_facet<std::moneypunct<char>>(loc).curr_symbol()
              << " for short\n";
}
int main()
{
    show_ccy("en_US.utf8");
    show_ccy("ja_JP.utf8");
    show_ccy("sv_SE.utf8");
    show_ccy("ru_RU.utf8");
    show_ccy("vi_VN.utf8");
}

二次

产出:

二次

代码语言:javascript
复制
en_US.utf8 currency symbol is USD or $ for short
ja_JP.utf8 currency symbol is JPY or ¥ for short
sv_SE.utf8 currency symbol is SEK or kr for short
ru_RU.utf8 currency symbol is RUB or руб for short
vi_VN.utf8 currency symbol is VND or ? for short

二次

另见

do_pos_formatdo_neg_format virtual

provides the formatting pattern for currency values (virtual protected member function)

代码语言:txt
复制
 ? cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com