std:: isblank (std::locale)
From cppreference.net
C++
Text processing library
| Localization library | |||||||||||||||||||||||||
| Regular expressions library (C++11) | |||||||||||||||||||||||||
| Formatting library (C++20) | |||||||||||||||||||||||||
| Null-terminated sequence utilities | |||||||||||||||||||||||||
| Byte strings | |||||||||||||||||||||||||
| Multibyte strings | |||||||||||||||||||||||||
| Wide strings | |||||||||||||||||||||||||
| Primitive numeric conversions | |||||||||||||||||||||||||
|
|||||||||||||||||||||||||
| Text encoding identifications | |||||||||||||||||||||||||
|
|||||||||||||||||||||||||
Localization library
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ヘッダーで定義
<locale>
|
||
|
template
<
class
CharT
>
bool isblank ( CharT ch, const locale & loc ) ; |
(C++11以降) | |
指定された文字が、指定されたロケールの std::ctype ファセットによって空白文字として分類されるかどうかをチェックします。
目次 |
パラメータ
| ch | - | 文字 |
| loc | - | ロケール |
戻り値
文字が空白文字として分類される場合は true を返し、それ以外の場合は false を返します。
実装例
template<class CharT> bool isblank(CharT ch, const std::locale& loc) { return std::use_facet<std::ctype<CharT>>(loc).is(std::ctype_base::blank, ch); } |
例
異なるロケール(OS固有)での
isblank()
の使用例を示します。
このコードを実行
#include <iostream> #include <locale> void try_with(wchar_t c, const char* loc) { std::wcout << "isblank('" << c << "', locale(\"" << loc << "\")) returned " << std::boolalpha << std::isblank(c, std::locale(loc)) << '\n'; } int main() { const wchar_t IDEO_SPACE = L'\u3000'; // Unicode character 'IDEOGRAPHIC SPACE' try_with(IDEO_SPACE, "C"); try_with(IDEO_SPACE, "en_US.UTF-8"); }
出力例:
isblank(' ', locale("C")) returned false
isblank(' ', locale("en_US.UTF-8")) returned true
関連項目
|
(C++11)
|
文字が空白文字かどうかをチェックする
(関数) |
|
(C++11)
|
ワイド文字が空白文字かどうかをチェックする
(関数) |