C++ Standard Library C++ STL Library

C++ <cwctype> - wctype_t Type



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

Example:

The example below shows the usage of wctype_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