std::towlower
From cppreference.com
| ヘッダ <cwctype> で定義 |
||
| std::wint_t towlower( std::wint_t ch ); |
||
指定されたワイド文字を、可能な場合は小文字に変換します。
ch の値が wchar_t として表現可能でもなく、マクロ WEOF の値と等しくもない場合、動作は未定義です。
目次 |
[編集] パラメータ
| 文字 | - | 変換するワイド文字 |
[編集] 戻り値
指定された文字chの小文字バージョン。現在のCロケールで小文字バージョンが定義されていない場合は、変更されません。
[編集] 注釈
この関数で実行できるのは1対1の文字マッピングのみです。例えば、ギリシャ語の大文字「'Σ'」には、単語内の位置によって2つの小文字の形式(「'σ'」と「'ς'」)があります。この場合、std::towlowerを呼び出しても正しい小文字の形式を取得することはできません。
ISO 30112 は、Unicode文字のどのペアがこのマッピングに含まれるかを規定しています。
[編集] 例
このコードを実行
#include <clocale> #include <cwctype> #include <iostream> int main() { wchar_t c = L'\u0190'; // Latin capital open E ('Ɛ') std::cout << std::hex << std::showbase; std::cout << "in the default locale, towlower(" << static_cast<std::wint_t>(c) << ") = " << std::towlower(c) << '\n'; std::setlocale(LC_ALL, "en_US.utf8"); std::cout << "in Unicode locale, towlower(" << static_cast<std::wint_t>(c) << ") = " << std::towlower(c) << '\n'; }
出力
in the default locale, towlower(0x190) = 0x190 in Unicode locale, towlower(0x190) = 0x25b
[編集] 関連項目
| ワイド文字を大文字に変換する (関数) | |
ロケールの ctype ファセットを使用して文字を小文字に変換する(関数テンプレート) | |
| 文字を小文字に変換する (関数) | |
| C言語のドキュメント (towlower)
| |