std::islower(std::locale)
来自 cppreference.cn
                    
                                        
                    
                    
                                                            
                    | 定义于头文件  <locale> | ||
| template< class CharT > bool islower( CharT ch, const locale& loc ); | ||
检查给定字符是否被给定区域设置的 std::ctype facet 分类为小写字母字符。
| 目录 | 
[编辑] 参数
| ch | - | 字符 | 
| loc | - | locale | 
[编辑] 返回值
如果字符被分类为小写,则返回 true,否则返回 false。
[编辑] 可能的实现
| template<class CharT> bool islower(CharT ch, const std::locale& loc) { return std::use_facet<std::ctype<CharT>>(loc).is(std::ctype_base::lower, ch); } | 
[编辑] 示例
演示了 `islower()` 在不同区域设置下的使用(操作系统相关)。
运行此代码
#include <iostream> #include <locale> int main() { const wchar_t c = L'\u03c0'; // GREEK SMALL LETTER PI std::locale loc1("C"); std::cout << std::boolalpha << "islower('π', C locale) returned " << std::islower(c, loc1) << '\n' << "isupper('π', C locale) returned " << std::isupper(c, loc1) << '\n'; std::locale loc2("en_US.UTF8"); std::cout << "islower('π', Unicode locale) returned " << std::islower(c, loc2) << '\n' << "isupper('π', Unicode locale) returned " << std::isupper(c, loc2) << '\n'; }
可能的输出
islower('π', C locale) returned false
isupper('π', C locale) returned false
islower('π', Unicode locale) returned true
isupper('π', Unicode locale) returned false[编辑] 另请参阅
| 检查字符是否为小写字母 (函数) | |
| 检查宽字符是否为小写 (函数) | 


