C++ Standard Library C++ STL Library

C++ <cwctype> - wctrans_t Type



The C++ <cwctype> wctrans_t is a scalar type that can hold values which represent locale-specific character transformations. This is the type returned by wctrans() function, and depends on the LC_CTYPE category selected at the time of the call.

Example:

The example below shows the usage of wctrans_t type.

#include <cstdio>
#include <cwchar>
#include <cwctype>
 
int main (){
  int i = 0;
  wchar_t str[50] = L"99HEllo@";
  wchar_t c;

  //displaying the alphabetic 
  //character in upper case
  wctype_t check = wctype("alpha");
  wctrans_t trans = wctrans("toupper");
  while (str[i]) {
    c = str[i];
    if (iswctype(c, check)) {
      c = towctrans(c, trans);
      putwchar (c);      
    }
    i++;
  }
  return 0;
}

The output of the above code will be:

HELLO

❮ C++ <cwctype> Library