名稱空間
變體
操作

std::islower(std::locale)

來自 cppreference.com
< cpp‎ | 本地化
 
 
 
 
定義於標頭檔案 <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

[編輯] 另請參閱

檢查字元是否為小寫字母
(函式) [編輯]
檢查寬字元是否為小寫
(函式) [編輯]