do_curr_symbol
STD::货币区::Curr[医]符号,做[医]柯尔[医]符号
Defined in header | | |
---|---|---|
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字符,如"¥"
或"$"
.如果International
是true
,标识符通常是一个包含三个字符的国际货币代码的四个字符字符串,后面是空格%28。"JPY "
或"USD "
%29
返回值
类型对象string_type
持有货币符号或代码。
例
二次
#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"
}
二次
产出:
二次
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) |
---|
© cppreference.com
在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。
http://en.cppreference.com/w/cpp/locale/Moneyypunct/Curr[医]符号