std::isblank(std::locale)(3)
π NAME π
std::isblank(std::locale) - std::isblank(std::locale)
Okay bestie, this is the std::isblank(std::locale)(3) page from the C++ Standard Libary manual (yes, βLibaryβ with one r in the header, we respect the lore π
). Itβs the locale-aware blank-character check, and itβs lowkey iconic.
π Synopsis π
Defined in header <locale>
template< class CharT > (since C++11)
bool isblank( CharT ch, const locale& loc );
So what does it do? It checks if the given character is classified as a blank character by the given localeβs std::ctype facet. Thatβs the whole vibe check. β¨
πΈ Parameters πΈ
chβ characterlocβ locale
π«Ά Return value π«Ά
Returns true if the character is classified as a blank character, false otherwise. No cap, thatβs it. π
π§ Possible implementation π§
Hereβs a possible implementation, like a fan recreation of the functionβs fit:
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);
}
β¨ Example β¨
Demonstrates the use of isblank() with different locales (OS-specific).
The page has a lil // Run this code note before the snippet, so hereβs the code in all its glory:
#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");
}
π Possible output π
That gap inside the quotes is the IDEO_SPACE from the example, bestie β the ideographic space is serving looks:
isblank('γ', locale("C")) returned false
isblank('γ', locale("en_US.UTF-8")) returned true
π₯ See also π₯
isblankβ checks if a character is a blank character;(C++11)(function)iswblankβ checks if a wide character is a blank character;(C++11)(function)
Thatβs the whole vibe check, bestie. This page came from http://cppreference.com, dated 2024.06.10, and itβs filed under std::isblank(std::locale)(3). Go classify some blanks with your favorite locale, mwah πβ¨
π¦ 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