std:: isgraph (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 isgraph ( CharT ch, const locale & loc ) ; |
||
指定された文字が、指定されたロケールの std::ctype ファセットによって図形文字(すなわち、空白を除く印字可能文字)として分類されるかどうかをチェックします。
目次 |
パラメータ
| ch | - | 文字 |
| loc | - | ロケール |
戻り値
文字が図形文字として分類される場合は true を返し、それ以外の場合は false を返します。
実装例
template<class CharT> bool isgraph(CharT ch, const std::locale& loc) { return std::use_facet<std::ctype<CharT>>(loc).is(std::ctype_base::graph, ch); } |
例
異なるロケール(OS固有)での
isgraph()
の使用例を示します。
このコードを実行
#include <iostream> #include <locale> int main() { const wchar_t c = L'\u2a0c'; // quadruple integral std::locale loc1("C"); std::cout << "isgraph('⨌', C locale) returned " << std::boolalpha << std::isgraph(c, loc1) << '\n'; std::locale loc2("en_US.UTF-8"); std::cout << "isgraph('⨌', Unicode locale) returned " << std::boolalpha << std::isgraph(c, loc2) << '\n'; }
出力例:
isgraph('⨌', C locale) returned false
isgraph('⨌', Unicode locale) returned true
関連項目
|
文字が図形文字かどうかをチェックする
(関数) |
|
|
ワイド文字が図形文字かどうかをチェックする
(関数) |