std::moneypunct<CharT,International>::decimal_point, do_decimal_point
From cppreference.com
< cpp | locale | moneypunct
| ヘッダー <locale> で定義 |
||
| public: CharT decimal_point() const; |
(1) | |
| protected: virtual CharT do_decimal_point() const; |
(2) | |
1) 公開メンバ関数。最派生クラスのメンバ関数
do_decimal_pointを呼び出します。2) 形式が小数部を使用する場合(つまり、do_frac_digits() がゼロより大きい場合)に、通貨I/Oにおける小数点の区切り文字として使用する文字を返します。典型的な米国ロケールでは、文字は'.'(またはL'.')です。
[編集] 戻り値
小数点文字を含む型CharTのオブジェクト。
[編集] 例
このコードを実行
#include <iomanip> #include <iostream> #include <locale> void show_dpt(const char* locname) { std::locale loc(locname); std::cout.imbue(loc); std::cout << locname << " decimal point is '" << std::use_facet<std::moneypunct<char>>(loc).decimal_point() << "' for example: " << std::showbase << std::put_money(123); if (std::use_facet<std::moneypunct<char>>(loc).frac_digits() == 0) std::cout << " (does not use frac digits)"; std::cout << '\n'; } int main() { show_dpt("en_US.utf8"); show_dpt("ja_JP.utf8"); show_dpt("sv_SE.utf8"); show_dpt("de_DE.utf8"); }
出力
en_US.utf8 decimal point is '.' for example: $1.23 ja_JP.utf8 decimal point is '.' for example: ¥123 (does not use frac digits) sv_SE.utf8 decimal point is ',' for example: 1,23 kr de_DE.utf8 decimal point is ',' for example: 1,23 €
[編集] 関連項目
| [virtual] |
小数点以下の桁数を提供します。 (仮想保護メンバ関数) |