toupper, _mbctoupper, towupper
Nach oben zu ctype.h - Index
Header-Datei
ctype.h, mbstring.h
Kategorie
Konvertierungsroutinen
Prototyp
int toupper(int ch);
int towupper(wint_t ch); // Unicode-Version
unsigned int _mbctoupper(unsigned int c);
Beschreibung
Konvertiert Zeichen in Großbuchstaben.
toupper ist eine Funktion, die einen Integerwert ch (im Bereich von EOF bis 255) in den Wert des entsprechenden Großbuchstabens konvertiert (bei den Kleinbuchstaben a bis z also A bis Z). Alle anderen Werte bleiben unverändert.
towupper ist die Unicode-Version von toupper. Diese Funktion ist verfügbar, wenn Unicode definiert ist.
Rückgabewert
toupper gibt den konvertierten Wert von ch zurück, wenn ch ein Kleinbuchstabe ist. Alle anderen Werte werden unverändert zurückgegeben.
Beispiel
#include <string.h>
#include <stdio.h>
#include <ctype.h>
int main(void)
{
int length, i;
char *string = "this is a string";
length = strlen(string);
for (i=0; i<length; i++)
{
string[i] = toupper(string[i]);
}
printf("%s\n",string);
return 0;
}
Portabilität
POSIX | Win32 | ANSI C | ANSI C++ | |
---|---|---|---|---|
toupper |
+ |
+ |
+ |
+ |
_mbctoupper |
+ |
|||
towupper |
+ |
+ |
+ |