ctype::tolower

Converts a character or a range of characters to lower case.

CharType tolower(
    CharType ch
) const;
const CharType *tolower(
    CharType* first, 
    const CharType* last,
) const;

Parameters

  • ch
    The character to be converted to lower case.

  • first
    A pointer to the first character in the range of characters whose cases are to be converted.

  • last
    A pointer to the character immediately following the last character in the range of characters whose cases are to be converted.

Return Value

The first member function returns the lowercase form of the parameter ch. If no lowercase form exists, it returns ch.

The second member function returns last.

Remarks

The first member function returns do_tolower(ch). The second member function returns do_tolower(first, last).

Example

// ctype_tolower.cpp
// compile with: /EHsc
#include <locale>
#include <iostream>
using namespace std;

int main( )
{
   locale loc1 ( "German_Germany" );
   
   char string[] = "HELLO, MY NAME IS JOHN";

   use_facet<ctype<char> > ( loc1 ).tolower
      ( string, string + strlen(string) );
   cout << "The lowercase string is: " << string << endl;
}
The lowercase string is: hello, my name is john

Requirements

Header: <locale>

Namespace: std

See Also

Reference

ctype Class