C Tutorial/Wide Character String/Change Case
Версия от 14:21, 25 мая 2010; (обсуждение)
Change case
The functions wctrans() and towctrans() are also defined in <wctype.h>
wctrans_t wctrans(const char *mapping);
wint_t towctrans(wint_t ch, wctrans_t mapping_ob);
Change wide character string to uppercase
#include <stdio.h>
#include <wchar.h>
int main(void)
{
wchar_t text[100];
printf("\nEnter the string to be searched(less than 100 characters):\n");
fgetws(text, 100, stdin);
/* Convert both strings to uppercase. */
int i;
for(i = 0 ; (text[i] = towupper(text[i])) ; i++);
printf("\nFirst string entered:\n%S\n", text);
}
Enter the string to be searched(less than 100 characters): asdf First string entered: ASDF