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
|
||||
|
헤더 파일에 정의됨
<locale>
|
||
|
public
:
CharT decimal_point ( ) const ; |
(1) | |
|
protected
:
virtual CharT do_decimal_point ( ) const ; |
(2) | |
1)
Public 멤버 함수, 가장 파생된 클래스의
do_decimal_point
멤버 함수를 호출합니다.
2)
형식이 분수를 사용하는 경우(즉,
do_frac_digits()
가 0보다 큰 경우) 통화 입출력에서 소수점 구분자로 사용할 문자를 반환합니다. 일반적인 미국 로캘에서는 문자
'.'
(또는
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]
|
소수점 이하 표시할 자릿수를 제공함
(가상 protected 멤버 함수) |