iswctype - C wctype.h

C examples for wctype.h:iswctype

Type

function

From


<cwctype>
<wctype.h>

Prototype

int iswctype(wint_t c, wctype_t desc);

Description

Checks whether c has the property specified by desc.

string passed to wctype description equivalent function
"alnum" alphanumerical character iswalnum
"alpha" letter character iswalpha
"blank" blank character iswblank
"cntrl" control character iswcntrl
"digit" decimal digit character iswdigit
"graph" character with graphical representation iswgraph
"lower" lowercase letter character iswlower
"print" printable character iswprint
"punct" punctuation character iswpunct
"space" white-space character iswspace
"upper" uppercase letter character iswupper
"xdigit" hexadecimal digit character iswxdigit

Parameters

Parameter Description
c Wide character to be checked
desc A value returned by a call to wctype

Return Value

A non zero value (i.e., true) if c is has the property identified by desc. Zero (i.e., false) otherwise.

Demo Code


#include <stdio.h>
#include <wctype.h>
int main ()//from w w  w.j  av  a  2 s  .  co m
{
  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;
}

Related Tutorials