最終更新日時:
が更新

履歴 編集

function
<cwctype>

std::wctype

namespace std {
  wctype_t wctype(const char* property);
}

概要

種別の名前から、iswctype()に渡す種別の値を取得する。

種別の名前は、現在のロケールのLC_CTYPEカテゴリが定義する。"alnum"・"alpha"・"blank"・"cntrl"・"digit"・"graph"・"lower"・"print"・"punct"・"space"・"upper"・"xdigit"はどのロケールでも有効であり、それぞれiswalnum()などの関数と同じ判定になる。

戻り値

propertyに対応する種別を表すwctype_t型の値。現在のロケールがpropertyという名前の種別を定義していない場合は0を返す。

例

#include <cwctype>
#include <iostream>

int main()
{
  std::cout << std::boolalpha;

  // 有効な種別名からは0以外の値が得られる
  std::cout << (std::wctype("digit") != 0) << std::endl;

  // 定義されていない種別名に対しては0を返す
  std::cout << (std::wctype("nonexistent") != 0) << std::endl;
}

出力

true
false

バージョン

言語

  • C++98

関連項目