最終更新日時:
が更新

履歴 編集

function
<locale>

std::ctype::tolower

charT
  tolower(charT c) const;           // (1) C++98

const charT*
  tolower(charT* low,
          const charT* high) const; // (2) C++98

概要

小文字に変換する。

  • (1) : 文字cを小文字に変換する
  • (2) : 範囲[low, high)の各文字を小文字に変換する

戻り値

#include <iostream>
#include <locale>
#include <string>

int main()
{
  const auto& ct = std::use_facet<std::ctype<char>>(std::locale::classic());

  // (1)
  std::cout << ct.tolower('A') << std::endl;

  // (2)
  std::string s = "ABC";
  ct.tolower(&s[0], &s[0] + s.size());
  std::cout << s << std::endl;
}

出力

a
abc

バージョン

言語

  • C++98

関連項目