std::iswcntrl(3)
π std::iswcntrl(3) π
okay so this page is from the C++ Standard Libary manual (yes, that's literally how it's spelled, no cap) and it's all about std::iswcntrl. Buckle up, bestie, we're checking wide control characters. π
πΈ NAME πΈ
std::iswcntrl β std::iswcntrl (the name is the name, periodt). π
β¨ Synopsis β¨
Defined in header <cwctype>
int iswcntrl( std::wint_t ch );
Checks if the given wide character is a control character, i.e. codes 0x00-0x1F and 0x7F and any control characters specific to the current locale. π¦
β οΈ If the value ofchis neither representable as awchar_tnor equal to the value of the macroWEOF, the behavior is undefined. That's undefined behavior, bestie β do not play with it. π
π Parameters π
chβ wide character. That's the whole parameter. Slay simplicity. π«Ά
π Return value π
Non-zero value if the wide character is a control character, zero otherwise. Easy peasy. β¨
π¦ Notes π¦
ISO 30112 defines POSIX control characters as Unicode characters U+0000..U+001F, U+007F..U+009F, U+2028, and U+2029 (Unicode classes Cc, Zl, and Zp). Iconic standardization behavior. π
π₯ Example π₯
// Run this code
#include <clocale>
#include <cwctype>
#include <iostream>
int main()
{
wchar_t c = L'\u2028'; // the Unicode character "line separator"
std::cout << std::hex << std::showbase << std::boolalpha;
std::cout << "in the default locale, iswcntrl(" << (std::wint_t)c << ") = "
<< (bool)std::iswcntrl(c) << '\n';
std::setlocale(LC_ALL, "en_US.utf8");
std::cout << "in Unicode locale, iswcntrl(" << (std::wint_t)c << ") = "
<< (bool)std::iswcntrl(c) << '\n';
}
π» Output π»
in the default locale, iswcntrl(0x2028) = false
in Unicode locale, iswcntrl(0x2028) = true
π See also π
iscntrl(std::locale)β checks if a character is classified as a control character by a locale (function template). πiscntrlβ checks if a character is a control character (function). β¨- C documentation for
iswcntrlβ the C version is also a thing, iykyk. π«Ά
π ASCII values table π
okay so here's the big ASCII classification chart. The original header lists these columns: iscntrl, isprint, isspace, isblank, isgraph, ispunct, isalnum, isalpha, isupper, islower, isdigit, isxdigit, and also the wide-char ones: iswcntrl, iswprint, iswspace, iswblank, iswgraph, iswpunct, iswalnum, iswalpha, iswupper, iswlower, iswdigit, iswxdigit. The rows below show the 12 classification flags as they appear in the original table. No cap, it's a lot. π
dec hex oct char iscntrl isprint isspace isblank isgraph ispunct isalnum isalpha isupper islower isdigit isxdigit
0β8 \x0β\x8 \0β\10 control codes (NUL, etc.) β 0 0 0 0 0 0 0 0 0 0 0 0
9 \x9 \11 tab (\t) β 0 0 β 0 β 0 0 0 0 0 0 0 0 0
10β13 \xAβ\xD \12β\15 (\n, \v, \f, \r) whitespaces β 0 0 β 0 0 0 0 0 0 0 0 0 0
14β31 \xEβ\x1F \16β\37 control codes β 0 0 0 0 0 0 0 0 0 0 0 0
32 \x20 \40 space 0 β 0 β 0 β 0 0 0 0 0 0 0 0 0
33β47 \x21β\x2F \41β\57 !"#$%&'()*+,-./ 0 β 0 0 0 β 0 β 0 0 0 0 0 0 0
48β57 \x30β\x39 \60β\71 0123456789 0 β 0 0 0 β 0 0 β 0 0 0 0 β 0 β 0
58β64 \x3Aβ\x40 \72β\100 :;<=>?@ 0 β 0 0 0 β 0 β 0 0 0 0 0 0 0
65β70 \x41β\x46 \101β\106 ABCDEF 0 β 0 0 0 β 0 0 β 0 β 0 β 0 0 0 β 0
71β90 \x47β\x5A \107β\132 GHIJKLMNOPQRSTUVWXYZ 0 β 0 0 0 β 0 0 β 0 β 0 β 0 0 0 0
91β96 \x5Bβ\x60 \133β\140 [\]^_` 0 β 0 0 0 β 0 β 0 0 0 0 0 0 0
97β102 \x61β\x66 \141β\146 abcdef 0 β 0 0 0 β 0 0 β 0 β 0 0 β 0 0 β 0
103β122 \x67β\x7A \147β\172 ghijklmnopqrstuvwxyz 0 β 0 0 0 β 0 0 β 0 β 0 0 β 0 0 0
123β126 \x7Bβ\x7E \172β\176 {|}~ 0 β 0 0 0 β 0 β 0 0 0 0 0 0 0
127 \x7F \177 backspace character (DEL) β 0 0 0 0 0 0 0 0 0 0 0 0
π that's the whole page, bestie! source/version:http://cppreference.comΒ· date:2024.06.10Β· page:std::iswcntrl(3). stay slay and don't pass invalidchvalues. 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