std:: towctrans
| 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 | |||||||||||||||||||||||||
|
|||||||||||||||||||||||||
| Functions | ||||||||||||||||||||||||||
| Character classification | ||||||||||||||||||||||||||
| Character manipulation | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
| Conversions to numeric formats | ||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||
| String manipulation | ||||||||||||||||||||||||||
| String examination | ||||||||||||||||||||||||||
| Array manipulation | ||||||||||||||||||||||||||
|
헤더 파일에 정의됨
<cwctype>
|
||
|
std::
wint_t
towctrans
(
std::
wint_t
ch,
std::
wctrans_t
desc
)
;
|
||
현재 C 로케일의 ch 와이드 문자를 LC_CTYPE 매핑 카테고리를 사용하여 desc 로 식별된 매핑을 수행합니다.
ch 값이 wchar_t 로 표현 가능하지도 않고 매크로 WEOF 값과 같지도 않다면, 동작은 정의되지 않습니다.
목차 |
매개변수
| ch | - | 매핑할 와이드 문자 |
| desc | - | LC_CTYPE 매핑, std::wctrans 호출로부터 획득 |
반환값
ch 의 매핑된 값으로, 현재 C 로케일의 LC_CTYPE 패싯에서 desc 로 식별된 매핑을 사용합니다.
예제
다음 예제는 가타카나에서 히라가나 문자 매핑을 보여줍니다.
#include <algorithm> #include <clocale> #include <cwctype> #include <iostream> std::wstring tohira(std::wstring str) { std::transform(str.begin(), str.end(), str.begin(), [](wchar_t c) { return std::towctrans(c, std::wctrans("tojhira")); }); return str; } int main() { std::setlocale(LC_ALL, "ja_JP.UTF-8"); std::wstring kana = L"ヒラガナ"; std::wcout << "katakana characters " << kana << " are " << tohira(kana) << " in hiragana\n"; }
출력:
katakana characters ヒラガナ are ひらがな in hiragana
참고 항목
|
현재 C 로캘에서 문자 매핑 카테고리를 조회합니다
(함수) |
|
|
C 문서
for
towctrans
|
|