Format
#include <wctype.h> wint_t towlower(wint_t wc); wint_t towupper(wint_t wc);
Language Level: ANSI
Threadsafe: Yes.
Description
The towupper() function converts the lowercase character wc to the corresponding uppercase letter. The towlower() function converts the uppercase character wc to the corresponding lowercase letter.
Return Value
If wc is a wide character for which iswupper() (or iswlower()) is true and there is a corresponding wide character for which iswlower() (or iswupper()) is true, towlower() (or towupper()) returns the corresponding wide character. Otherwise, the argument is returned unchanged.
Example that uses towlower() and towupper()
This example uses towlower() and towupper() to convert characters between 0 and 0x7f.
#include <wctype.h> #include <stdio.h> int main(void) { wint_t w_ch; for (w_ch = 0; w_ch <= 0xff; 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 : 0xc1 0xc1, towlower : 0xc1 0x81 towupper : 0xc2 0xc2, towlower : 0xc2 0x82 towupper : 0xc3 0xc3, towlower : 0xc3 0x83 towupper : 0xc4 0xc4, towlower : 0xc4 0x84 towupper : 0xc5 0xc5, towlower : 0xc5 0x85 : towupper : 0x81 0xc1, towlower : 0x81 0x81 towupper : 0x82 0xc2, towlower : 0x82 0x82 towupper : 0x83 0xc3, towlower : 0x83 0x83 towupper : 0x84 0xc4, towlower : 0x84 0x84 towupper : 0x85 0xc5, towlower : 0x85 0x85 : **********************************************************************/ }
Related Information
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.