wctype.h - header file of the standard library of the C programming language. Contains functions for working with individual "wide" characters.
| Standard library C programming language |
|
Functions
Functions for Separating Characters
| Function | Description |
|---|---|
iswalnum | Checks if a character is a letter or a number |
iswalpha | Checks if a character is a letter |
iswblank | Checks if the character is “blank” (space, tab, etc.) |
iswcntrl | Checks if a character is a control character |
iswdigit | Checks if a character is a decimal digit |
iswgraph | Checks if a character has a graphical representation |
iswlower | Checks if a character is a lowercase letter |
iswprint | Checks if a character is printable |
iswpunct | Checks if a character is a punctuation mark |
iswspace | Checks if a character is a space |
iswupper | Checks if a character is uppercase |
iswxdigit | Checks if a character is a hexadecimal digit |
Other Functions
| Function | Description |
|---|---|
towlower | Returns a lowercase character |
towupper | Returns an uppercase character |
wint_t towctrans ( wint_t c , wctrans_t desc );
The function transforms a character depending on the string desc .
c = towctrans ( wint_t c , wctrans ( "toupper" )); // convert c to uppercase
c = towctrans ( wint_t c , wctrans ( "toulower" )); // translate the character c to lowercase
Constants
WEOF - “wide” end of file
Usage Example
Convert a string to lowercase:
#include <wchar.h>
#include <wctype.h>
int main ()
{
wchar_t str [] = L "Wikipedia. \ n " ;
for ( size_t i = 0 ; str [ i ] ! = L '\ 0' ; i ++ )
{
putwchar ( towlower ( str [ i ]));
}
return 0 ;
}
Links
wctype.h- Basic Definitions, The Single UNIX® Specification , Issue 7 by The Open Group