• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

    最終更新日時(UTC):
    が更新

    履歴 編集

    function
    <cctype>

    std::tolower

    namespace std {
      int tolower(int ch);
    }
    

    概要

    ch を小文字に変換する(変換はロケールの影響を受ける)。

    戻り値

    ch に小文字があれば、小文字化した ch。小文字がなければ ch

    #include <cctype>
    #include <iostream>
    
    int main() {
        std::cout << "tolower('A') = " << static_cast<char>(std::tolower('A')) << std::endl
                  << "tolower('a') = " << static_cast<char>(std::tolower('a')) << std::endl
                  << "tolower('1') = " << static_cast<char>(std::tolower('1')) << std::endl
                  << "tolower('.') = " << static_cast<char>(std::tolower('.')) << std::endl
                  << "tolower('$') = " << static_cast<char>(std::tolower('$')) << std::endl;
    }
    

    出力例

    tolower('A') = a
    tolower('a') = a
    tolower('1') = 1
    tolower('.') = .
    tolower('$') = $