最終更新日時:
が更新

履歴 編集

function
<cwctype>

std::wctrans

namespace std {
  wctrans_t wctrans(const char* property);
}

概要

変換規則の名前から、towctrans()に渡す変換規則の値を取得する。

変換規則の名前は、現在のロケールのLC_CTYPEカテゴリが定義する。"tolower"と"toupper"はどのロケールでも有効であり、それぞれtowlower()・towupper()と同じ変換になる。

戻り値

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

例

#include <cwctype>
#include <iostream>

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

  // 有効な変換規則名からは0以外の値が得られる
  std::cout << (std::wctrans("toupper") != 0) << std::endl;

  // 定義されていない変換規則名に対しては0を返す
  std::cout << (std::wctrans("nonexistent") != 0) << std::endl;
}

出力

true
false

バージョン

言語

  • C++98

関連項目