Format
#include <wctype.h> wint_t towlower(wint_t wc); wint_t towupper(wint_t wc);
Language Level: ANSI 93, POSIX
towlower converts the uppercase letter wc to the
corresponding lowercase letter.
The character mapping is determined by the LC_CTYPE category of current locale.
Return Value
Both functions return the converted character. If the
wide character wc does not have a corresponding
lowercase or uppercase character, the functions return wc
unchanged.
Example
This example uses towlower and towupper to convert
characters between 0 and 0x7f.
#include <wchar.h> #include <wctype.h> #include <stdio.h>
int main(void)
{
wint_t w_ch;
for (w_ch = 0; w_ch <= 0x7f; w_ch++) {
printf ("towupper : %#04x %#04x, ", w_ch, towupper(w_ch));
printf ("towlower : %#04x %#04x\n", w_ch, towlower(w_ch));
}
return 0;
/*************************************************************
The output should be similar to :
.
:
towupper : 0x41 0x41, towlower : 0x41 0x61
towupper : 0x42 0x42, towlower : 0x42 0x62
towupper : 0x43 0x43, towlower : 0x43 0x63
towupper : 0x44 0x44, towlower : 0x44 0x64
towupper : 0x45 0x45, towlower : 0x45 0x65
.
:
towupper : 0x61 0x41, towlower : 0x61 0x61
towupper : 0x62 0x42, towlower : 0x62 0x62
towupper : 0x63 0x43, towlower : 0x63 0x63
towupper : 0x64 0x44, towlower : 0x64 0x64
towupper : 0x65 0x45, towlower : 0x65 0x65
:
*************************************************************/
}
![]()
<wctype.h>
tolower - toupper -- Convert Character
Case
_toascii - _tolower - _toupper --
Convert Character