RAD Studio |  |

toupper, _mbctoupper, towupper

Header File

ctype.h, mbstring.h

Category

Conversion Routines

Prototype

int toupper(int ch);

int towupper(wint_t ch); // Unicode version

unsigned int _mbctoupper(unsigned int c);

Description

Translates characters to uppercase.

toupper is a function that converts an integer ch (in the range EOF to 255) to its uppercase value (A to Z; if it was lowercase, a to z). All others are left unchanged.

towupper is the Unicode version of toupper. It is available when Unicode is defined.

Return Value

toupper returns the converted value of ch if it is lowercase; it returns all others unchanged.

Example

Copy Code

    #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;
    }

Portability

| POSIX | Win32 | ANSI C | ANSI C++
toupper | + | + | + | +
_mbctoupper |  | + |  |
towupper |  | + | + | +

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!