function
<cwctype>

wctype

wctype_t wctype (const char* property);
Return character property
Returns a value of type wctype_t that corresponds to the character category specified by property.

A specific locale can accept multiple categories in which to classify its characters. At least the following categories are recognized by all locales:
string passed as propertydescriptionequivalent function
"alnum"alphanumerical characteriswalnum
"alpha"letter characteriswalpha
"blank"blank characteriswblank
"cntrl"control characteriswcntrl
"digit"decimal digit characteriswdigit
"graph"character with graphical representationiswgraph
"lower"lowercase letter characteriswlower
"print"printable characteriswprint
"punct"punctuation characteriswpunct
"space"white-space characteriswspace
"upper"uppercase letter characteriswupper
"xdigit"hexadecimal digit characteriswxdigit

The value returned by this function depends on the LC_CTYPE locale category selected.

Parameters

property
A string identifying a character category (see above).

Return Value

A value of type wctype_t identifying a specific character category.
This value is locale-dependent.

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* wctype example */
#include <stdio.h>
#include <wctype.h>
int main ()
{
  int i=0;
  wchar_t str[] = L"Test String.\n";
  wchar_t c;
  wctype_t check = wctype("lower");
  wctrans_t trans = wctrans("toupper");
  while (str[i])
  {
    c = str[i];
    if (iswctype(c,check)) c = towctrans(c,trans);
    putwchar (c);
    i++;
  }
  return 0;
}

Output:
TEST STRING.


See also