function
<cwctype>
wctrans
wctrans_t wctrans (const char* property);
Return character transformation
Returns a value of type wctrans_t that corresponds to the character transformation by property.
A specific locale can accept multiple transformations for characters. At least the following transformations are recognized by all locales:
string passed as property | description | equivalent function |
"tolower" | to lowercase | towlower |
"toupper" | to uppercase | towupper |
The value returned by this function depends on the LC_CTYPE locale category selected.
Parameters
- property
- A string identifying a character transformation (see above).
Return Value
A value of type wctrans_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
|
/* wctrans 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:
See also
- towctrans
- Convert using transformation (function
)
- wctype
- Return character property (function
)
- iswupper
- Check if wide character is uppercase letter (function
)
- iswlower
- Check if wide character is lowercase letter (function
)