La funzione wctrans () in C ++ restituisce un valore di tipo wctrans_t che corrisponde alla trasformazione.
La funzione wctrans () è definita nel file di intestazione.
prototipo di wctrans ()
wctrans_t wctrans (const char * str);
La funzione wctrans () accetta una stringa C come argomento e restituisce un valore di tipo wctrans_t utilizzato per mappare un carattere ampio.
Parametri wctrans ()
- str: stringa C che specifica la trasformazione desiderata.
wctrans () Restituisce il valore
- La funzione wctrans () restituisce un oggetto wctrans_t che può essere utilizzato con towctrans () per mappare caratteri larghi.
- Se str non fornisce una mappatura supportata dalla locale C corrente, restituisce zero.
Esempio: come funziona la funzione wctrans ()?
#include #include #include #include using namespace std; int main() ( setlocale(LC_ALL, "en_US.UTF-8"); wchar_t str() = L"Ŝŵitĉhiňģ Ćăse"; wcout << L"Before transformation" << endl; wcout << str << endl; for(int i=0; i
When you run the program, the output will be:
Before transformation Ŝŵitĉhiňģ Ćăse After transformation ŝŴITĈHIŇĢ ćĂSE