最終更新日時:
が更新

履歴 編集

function template
<locale>

std::isblank(C++11)

namespace std {
  template <class charT>
  bool isblank(charT c, const locale& loc); // (1) C++11
}

概要

localeを引数で指定できるisblank()関数。 文字cがブランク文字であるかどうかを、ロケールに基いて判定する。

ブランク文字とは、テキストの1行を単語に区切るために使われる、空白文字の一種である。"C"ロケールでは、半角スペースと水平タブがこれにあたる。

戻り値

std::use_facet<std::ctype<charT>>(loc).is(std::ctype_base::blank, c)を返す。

備考

localeを引数に取らないisblank()関数は、<cctype>ヘッダに存在する。

#include <locale>
#include <iostream>

int main()
{
  std::locale l = std::locale::classic();

  std::cout << std::boolalpha << std::isblank(' ', l) << std::endl;
  std::cout << std::isblank('a', l) << std::endl;
}

出力

true
false

バージョン

言語

  • C++11

処理系

実装例

template <class charT>
bool isblank(charT c, const locale& loc)
{
  return std::use_facet<std::ctype<charT>>(loc).is(std::ctype_base::blank, c);
}

関連項目

参照