RAD Studio |  |

tolower, _mbctolower, towlower

Header File

ctype.h, mbstring.h

Category

Conversion Routines

Prototype

int tolower(int ch);

int towlower(wint_t ch); // Unicode version

unsigned int _mbctolower(unsigned int c);

Description

Translates characters to lowercase.

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

Return Value

tolower returns the converted value of ch if it is uppercase; 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] = tolower(string[i]);
       }
       printf("%s\n",string);
       return 0;
    }

Portability

| POSIX | Win32 | ANSI C | ANSI C++
tolower | + | + | + | +
_mbctolower |  | + |  |
towlower |  | + | + | +

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