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
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Definiert im Header
<locale>
|
||
|
template
<
class
CharT
>
bool isgraph ( CharT ch, const locale & loc ) ; |
||
Prüft, ob das gegebene Zeichen durch die std::ctype Facette des gegebenen Locales als grafisches Zeichen klassifiziert wird (d.h. druckbar, außer Leerzeichen).
Inhaltsverzeichnis |
Parameter
| ch | - | Zeichen |
| loc | - | Gebietsschema |
Rückgabewert
Gibt true zurück, wenn das Zeichen als grafisch klassifiziert ist, false andernfalls.
Mögliche Implementierung
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); } |
Beispiel
Demonstriert die Verwendung von
isgraph()
mit verschiedenen Locales (betriebssystemspezifisch).
Diesen Code ausführen
#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'; }
Mögliche Ausgabe:
isgraph('⨌', C locale) returned false
isgraph('⨌', Unicode locale) returned true
Siehe auch
|
prüft, ob ein Zeichen ein grafisches Zeichen ist
(Funktion) |
|
|
prüft, ob ein Breitzeichen ein grafisches Zeichen ist
(Funktion) |