std::isblank(std::locale)
提供: cppreference.com
<tbody>
</tbody>
| ヘッダ <locale> で定義
|
||
template< class charT > bool isblank( charT ch, const locale& loc ); |
(C++11以上) | |
指定された文字が指定されたロケールの 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);
}
|
例
異なるロケールで isblank() の使用をデモンストレーションします (OS 固有)。
Run this code
#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) |
ワイド文字がブランク文字かどうか調べます (関数) |