std::moneypunct<CharT,International>:: decimal_point, do_decimal_point
From cppreference.net
<
cpp
|
locale
|
moneypunct
C++
Text processing library
| 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 | |||||||||||||||||||||||||
|
|||||||||||||||||||||||||
Localization library
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
std::moneypunct
| Member functions | ||||
|
moneypunct::decimal_point
moneypunct::do_decimal_point
|
||||
|
Definiert im Header
<locale>
|
||
|
public
:
CharT decimal_point ( ) const ; |
(1) | |
|
protected
:
virtual CharT do_decimal_point ( ) const ; |
(2) | |
1)
Öffentliche Memberfunktion, ruft die Memberfunktion
do_decimal_point
der am stärksten abgeleiteten Klasse auf.
2)
Gibt das Zeichen zurück, das als Dezimaltrennzeichen in monetärer Ein-/Ausgabe verwendet wird, wenn das Format Brüche verwendet (d.h. wenn
do_frac_digits()
größer als Null ist). Für typische US-Lokalisierungen ist es das Zeichen
'.'
(oder
L
'.'
).
Rückgabewert
Das Objekt vom Typ
CharT
, das das Dezimaltrennzeichen enthält.
Beispiel
Diesen Code ausführen
#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"); }
Ausgabe:
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 €
Siehe auch
|
[virtual]
|
liefert die Anzahl der nach dem Dezimalpunkt anzuzeigenden Ziffern
(geschützte virtuelle Elementfunktion) |