function template
<locale>
std::islower
template <class charT> bool islower (charT c, const locale& loc);
Check if character is a lowercase letter using locale
Checks whether c is a lowercase letter using the ctype facet of locale loc, returning the same as if ctype::is is called as:
1
|
use_facet < ctype<charT> > (loc).is (ctype_base::lower, c)
|
This function template overloads the C function islower (defined in <cctype>).
Parameters
- c
- Character to be checked.
- loc
- Locale to be used. It shall have a ctype facet.
The template argument charT is the character type.
Return Value
true
if indeed c is a lowercase letter.
false
otherwise.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
// islower example (C++)
#include <iostream> // std::cout
#include <string> // std::string
#include <locale> // std::locale, std::islower, std::toupper
int main ()
{
std::locale loc;
std::string str="Test String.\n";
char c;
for (std::string::size_type i=0; i<str.length(); ++i)
{
c=str[i];
if (std::islower(c,loc)) c=std::toupper(c,loc);
std::cout << c;
}
return 0;
}
|
Output:
Data races
Both loc and its ctype facet are accessed.
Exception safety
Strong guarantee: if an exception is thrown, there are no effects.
See also
- ctype
- Character type facet (class template)
- islower (cctype)
- Check if character is lowercase letter (function)
- isupper
- Check if character is an uppercase letter using locale (function template)
- isalpha
- Check if character is alphabetic using locale (function template)
- toupper
- Convert lowercase letter to uppercase using locale (function template)
- tolower
- Convert uppercase letter to lowercase using locale (function template)