function
<cwctype>
towupper
wint_t towupper (wint_t c);
Convert lowercase wide character to uppercase
Converts c to its uppercase equivalent if c is a lowercase letter and has an uppercase equivalent. If no such conversion is possible, the value returned is c unchanged.
Notice that what is considered a letter may depend on the locale being used.
If a lowercase character has more than one correspondent uppercase character, this function always returns the same character for the same value of c.
This function is the wide-character equivalent of toupper (<cctype>).
In C++, a locale-specific template version of this function (toupper) exists in header <locale> for all character types.
Parameters
- c
- Wide character to be converted, casted to a wint_t value, or WEOF.
wint_t is an integral type.
Return Value
The uppercase equivalent to c, if such value exists, or c (unchanged) otherwise.
The value is returned as a wint_t value that can be implicitly casted to wchar_t.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
/* towupper example */
#include <stdio.h>
#include <wctype.h>
int main ()
{
int i=0;
wchar_t str[] = L"Test String.\n";
wchar_t c;
while (str[i])
{
c = str[i];
putwchar (towupper(c));
i++;
}
return 0;
}
|
Output:
See also
- toupper
- Convert lowercase letter to uppercase (function
)
- towlower
- Convert uppercase wide character to lowercase (function
)
- iswupper
- Check if wide character is uppercase letter (function
)
- iswlower
- Check if wide character is lowercase letter (function
)
- iswalpha
- Check if wide character is alphabetic (function
)
- toupper (locale)
- Convert lowercase letter to uppercase using locale (function template
)