std::moneypunct<CharT,International>:: curr_symbol, do_curr_symbol
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::curr_symbol
moneypunct::do_curr_symbol
|
||||
|
헤더 파일에 정의됨
<locale>
|
||
|
public
:
string_type curr_symbol ( ) const ; |
(1) | |
|
protected
:
virtual string_type do_curr_symbol ( ) const ; |
(2) | |
1)
Public 멤버 함수, 가장 파생된 클래스의
do_curr_symbol
멤버 함수를 호출합니다.
2)
이 로캘이 사용하는 통화 식별자 문자열을 반환합니다.
International
(
std::moneypunct
의 두 번째 템플릿 매개변수)가
false
인 경우, 식별자는 일반적으로
"¥"
또는
"$"
와 같은 단일 (와이드) 문자입니다.
International
이
true
인 경우, 식별자는 일반적으로 세 문자
ISO 4217
통화 코드와 공백으로 구성된 4자 문자열입니다 (
"JPY "
또는
"USD "
).
목차 |
반환값
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
결함 보고서
다음의 동작 변경 결함 보고서들은 이전에 발표된 C++ 표준에 소급 적용되었습니다.
| DR | 적용 대상 | 게시된 동작 | 올바른 동작 |
|---|---|---|---|
| LWG 666 | C++98 |
International
이
true
일 경우
식별자 문자열의 길이가
4
로 요구됨
|
요구되지 않음 |
참고 항목
|
[virtual]
|
통화 값에 대한 형식 패턴을 제공함
(가상 protected 멤버 함수) |