tolower


function template
<locale>
template <class charT>
  charT tolower ( charT c, const locale& loc );

Convert uppercase letter to lowercase using locale

Converts parameter c to its lowercase equivalent if c is an uppercase letter and has a lowercase equivalent using ctype facet of locale loc. If no such conversion is possible, the value returned is c unchanged.

This function returns the same as a call to:

 
use_facet < ctype<charT> > (loc).tolower (c)


This function replicates the functionality of its C-library equivalent tolower. See tolower for more info.

Parameters

c
Character to be converted.
loc
Locale to be used. Shall have facet ctype present.


Template parameter charT is the character type.

Return Value

The lowercase equivalent to c, if any. Or c unchanged.

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
// tolower example (C++)
#include <iostream>
#include <string>
#include <locale>
using namespace std;

int main ()
{
  locale loc;
  string str="Test String.\n";
  for (size_t i=0; i<str.length(); ++i)
    cout << tolower(str[i],loc);
  return 0;
}


Output:

test string.


See also