◐ Shell
clean mode source ↗

std::towctrans - cppreference.com

De cppreference.com

<metanoindex/>

<tbody> </tbody>

Definido no cabeçalho

<cwctype>

std::wint_t towctrans( std::wint_t wc, std::wctrans_t desc );

Mapas do caráter amplo wc usando a categoria atual C locale LC_CTYPE mapeamento identificado por desc.

Original:

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

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Parâmetros

ch -

o caráter amplo para mapear

Original:

the wide character to map

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

desc -

o mapeamento LC_CTYPE, obtido a partir de uma chamada para std::wctrans

Original:

the LC_CTYPE mapping, obtained from a call to std::wctrans

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Valor de retorno

O valor de ch mapeada usando o mapeamento identificado por desc em faceta LC_CTYPE da localidade C atual.

Original:

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

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Exemplo

O exemplo a seguir demonstra katakana para o mapeamento de caracteres hiragana

Original:

The following example demonstrates katakana to hiragana character mapping

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

#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";
}

Saída:

katakana characters ヒラガナ are ひらがな in hiragana

Veja também

olha uma categoria de mapeamento de caracteres na localidade C atual

Original:

looks up a character mapping category in the current C locale

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função) [edit]