| Localization library | |||||||||||||||||||||||||
| Regular expressions library(C++11) | |||||||||||||||||||||||||
| Formatting library(C++20) | |||||||||||||||||||||||||
| Null-terminated sequence utilities | |||||||||||||||||||||||||
| Byte strings | |||||||||||||||||||||||||
| Multibyte strings | |||||||||||||||||||||||||
| Wide strings | |||||||||||||||||||||||||
| Primitive numeric conversions | |||||||||||||||||||||||||
| |||||||||||||||||||||||||
| Text encoding identifications | |||||||||||||||||||||||||
| |||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Member functions | ||||
moneypunct::decimal_pointmoneypunct::do_decimal_point | ||||
Defined in header <locale> | ||
public: CharT decimal_point()const; | (1) | |
protected: virtual CharT do_decimal_point()const; | (2) | |
do_decimal_point of the most derived class.The object of typeCharT holding the decimal point character.
#include <iomanip>#include <iostream>#include <locale> void show_dpt(constchar* 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");}
Output:
en_US.utf8 decimal point is '.' for example: $1.23ja_JP.utf8 decimal point is '.' for example: ¥123 (does not use frac digits)sv_SE.utf8 decimal point is ',' for example: 1,23 krde_DE.utf8 decimal point is ',' for example: 1,23 €
[virtual] | provides the number of digits to display after the decimal point (virtual protected member function)[edit] |