std::isgraph(std::locale)(3)
π NAME π
std::isgraph(std::locale) β std::isgraph(std::locale)
This page is from the C++ Standard Libary manual, bestie, and its title is std::isgraph(std::locale)(3). Itβs giving βis this character graphic?β energy, and weβre about to get into it. β¨
β¨ Synopsis β¨
Defined in header <locale>
template< class CharT >
bool isgraph( CharT ch, const locale& loc );
So this little icon checks if the given character is classified as a graphic character β thatβs literally βi.e. printable, excluding spaceβ β by the given localeβs std::ctype facet. No cap, thatβs the vibe check. π
π Parameters π
chβ characterlocβ locale
π₯ Return value π₯
Returns true if the character is classified as graphic, and false otherwise. Binary slay, periodt. π«Ά
π§ Possible implementation π§
Hereβs the possible implementation, literally right here:
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);
}
π Example π
Demonstrates the use of isgraph() with different locales (OS-specific). Obsessed with the locale range, ngl. π¦
// Run this code
#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';
}
β Possible output β
isgraph('β¨', C locale) returned false
isgraph('β¨', Unicode locale) returned true
π See also π
isgraphβ checks if a character is a graphical character (function)iswgraphβ checks if a wide character is a graphical character (function)
Catch you later, bestie π
π«Ά β this page is from http://cppreference.com, dated 2024.06.10, and itβs the std::isgraph(std::locale)(3) page. Bye! π
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms