| Defined in header <wctype.h> | ||
|---|---|---|
| wint_t towctrans( wint_t wc, wctrans_t desc ); | (since C95) | 
Maps the wide character wc using the current C locale's LC_CTYPE mapping category identified by desc.
| wc | - | the wide character to map | 
| desc | - | the LC_CTYPEmapping, obtained from a call towctrans | 
The mapped value of wc using the mapping identified by desc in LC_CTYPE facet of the current C locale.
#include <locale.h>
#include <wctype.h>
#include <wchar.h>
#include <stdio.h>
 
int main(void)
{
    setlocale(LC_ALL, "ja_JP.UTF-8");
    const wchar_t kana[] = L"ヒラガナ";
    size_t sz = sizeof kana / sizeof *kana;
    wchar_t hira[sz];
    for (size_t n = 0; n < sz; ++n)
        hira[n] = towctrans(kana[n], wctrans("tojhira"));
    printf("katakana characters %ls are %ls in hiragana\n", kana, hira);
}Output:
katakana characters ヒラガナ are ひらがな in hiragana
| (C95) | looks up a character mapping category in the current C locale (function) | 
| C++ documentation for towctrans | |
    © cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
    https://en.cppreference.com/w/c/string/wide/towctrans