GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::towctrans(3) C++ Standard Libary std::towctrans(3)

std::towctrans - std::towctrans


Defined in header <cwctype>
std::wint_t towctrans( std::wint_t wc, std::wctrans_t desc );


Maps the wide character wc using the current C locale's LC_CTYPE mapping category
identified by desc.


If the value of ch is neither representable as a wchar_t nor equal to the value of
the macro WEOF, the behavior is undefined.


ch - the wide character to map
desc - the LC_CTYPE mapping, obtained from a call to std::wctrans


The mapped value of ch using the mapping identified by desc in LC_CTYPE facet of the
current C locale.


The following example demonstrates katakana to hiragana character mapping

// Run this code


#include <clocale>
#include <cwctype>
#include <iostream>
#include <algorithm>


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


wctrans looks up a character mapping category in the current C locale
(function)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.