std::iscntrl(std::locale)(3)
β¨ NAME β¨
Okay bestie, this is the std::iscntrl(std::locale)(3) page, and the manual name is the C++ Standard Libary β folded in right here near the top instead of a copied header line, periodt. The function name is std::iscntrl(std::locale), and the page name is std::iscntrl(std::locale)(3). We're doing this. π
πΈ Synopsis πΈ
Defined in header <locale> β yes, it's giving header energy.
template< class CharT >
bool iscntrl( CharT ch, const locale& loc );
Checks if the given character is classified as a control 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 control character, false otherwise. No cap, that's the tea. β¨
π§ Possible implementation π§
Here's the possible implementation exactly as the page gives it:
template<class CharT>
bool iscntrl(CharT ch, const std::locale& loc)
{
return
std::use_facet<std::ctype<CharT>>(loc).is(std::ctype_base::cntrl, ch);
}
π Example π
This demonstrates the use of iscntrl() with different locales β and yes, it's OS-specific, bestie. π«Ά
// Run this code
#include <iostream>
#include <locale>
int main()
{
const wchar_t CCH = L'\u0094'; // Destructive Backspace in Unicode
std::locale loc1("C");
std::cout << "iscntrl(CCH, C locale) returned "
<< std::boolalpha << std::iscntrl(CCH, loc1) << '\n';
std::locale loc2("en_US.UTF8");
std::cout << "iscntrl(CCH, Unicode locale) returned "
<< std::boolalpha << std::iscntrl(CCH, loc2) << '\n';
}
π Possible output π
iscntrl(CCH, C locale) returned false
iscntrl(CCH, Unicode locale) returned true
π¦ See also π¦
iscntrlβ checks if a character is a control character (function)iswcntrlβ checks if a wide character is a control character (function)
Source/version/date tea β: http://cppreference.com Β· 2024.06.10 Β· std::iscntrl(std::locale)(3) β bye bestie, slay your locale checks π
β¨
π¦ 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