|
charT tolower (charT c) const;
const charT* tolower (charT* low, const charT* high) const;
Convert to lowercase
The first version returns the lowercase equivalent to c. If no such equivalent character exists, the value returned is c unchanged.
The second version replaces any uppercase caracters in the range [low,high) by its lowercase equivalent.
During its operation, this function simply calls the virtual protected member ctype::do_tolower, which is the member function in charge of performing the actions described above.
A global function with the same name (tolower) exists with the same behavior as the first version of this member function.
Parameters
- c
- Character to convert.
charT is the template parameter of ctype (i.e., the facet's character type).
- low, high
- Pointer to the initial and final characters of the sequence. The range used is [low,high), which contains all the characters between low and high, including the character pointed by low but not the character pointed by high.
charT is the template parameter of ctype (i.e., the facet's character type).
Return value
The first version returns the lowercase equivalent of c, or c itself if no such equivalent exists.
The second version returns high.
charT is the template parameter of ctype (i.e., the facet's character type).
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
// ctype::tolower example
#include <iostream>
#include <locale>
using namespace std;
int main ()
{
locale loc;
char site[] = "CPlusPlus.com";
cout << "The first letter of " << site << " as a lowercase is: ";
cout << use_facet< ctype<char> >(loc).tolower ( *site );
cout << "\n";
cout << "The result of converting " << site << " to lowercase is: ";
use_facet< ctype<char> >(loc).tolower ( site, site+sizeof(site) );
cout << site << "\n";
return 0;
}
|
Output:
The first letter of CPlusPlus.com as a lowercase is: c
The result of converting CPlusPlus.com to lowercase is: cplusplus.com
|
See also
tolower | Convert uppercase letter to lowercase using locale (function template) |
|