std::iswxdigit(3)
β¨ std::iswxdigit β¨
Okay so bestie, welcome to the glow-up era of std::iswxdigit. This isn't your boring manpage anymore β we're making wide-character classification iconic. Let's get into it π
πΈ NAME πΈ
std::iswxdigit β checks if a wide character is giving hexadecimal digit energy, no cap
π¦ SYNOPSIS π¦
Defined in header <cwctype>
int iswxdigit( wint_t ch );
Checks if the given wide character corresponds (if narrowed) to a hexadecimal numeric character, i.e. one of 0123456789abcdefABCDEF. Periodt.
The way that character classification should be β literally just vibes checking. π
β DESCRIPTION β
So here's the tea, bestie. This function vibe-checks your wide character ch and tells you if it's a hex digit when narrowed. The valid squad is:
0123456789abcdefABCDEF
That's it. That's the whole guest list. Everyone else? Not invited to the hex party. π
β οΈ Lowkey important warning: if the value ofchis neither representable as awchar_tnor equal to the value of the macroWEOF, the behavior is undefined. Like, completely undefined. Not a cute undefined. The bad undefined. So don't do that, bestie β fr fr. π
π PARAMETERS π
chβ wide character. The main character of this whole operation, honestly. π
π₯ RETURN VALUE π₯
- Non-zero value β if the wide character is a hexadecimal numeric character. Slay! It ate! β
- Zero β otherwise. Not a hex digit, not the vibe. β
π NOTES π
Okay so this is actually a really iconic note, pay attention. std::iswdigit and std::iswxdigit are the only standard wide character classification functions that are not affected by the currently installed C locale. The way that they're locale-independent? Obsessed. Truly built different. π«Ά
iykyk β locale changes can't touch these two. They stay in their lane and do their job regardless of whatever C locale situation is happening around them. Main character energy fr fr.
π§ EXAMPLE π§
// Run this code
#include <cwctype>
#include <iostream>
int main()
{
std::cout << std::boolalpha
<< (std::iswxdigit(L'a') != 0) << ' '
<< (std::iswxdigit(L'Γ€') != 0) << '\n';
}
Output:
true false
So L'a'? Total hex digit, it's in the abcdef squad, so true. π
L'Γ€'? Not hex. Not even close. Sorry bestie, false. π
The contrast is giving exactly what it needs to give. Chef's kiss. π¨βπ³π
π SEE ALSO π
isxdigit(std::locale)β checks if a character is classified as a hexadecimal digit by a locale (function template). The locale-aware cousin, if you're into that.isxdigitβ checks if a character is a hexadecimal character (function). The non-wide version, still iconic in its own way.- C documentation for
iswxdigitβ the original source material, for the curious besties who want to dig deeper. π΅οΈββοΈ
π ASCII VALUES TABLE π
Okay bestie, this is the full character classification table. It's long but it's all here, every single value, no skips. Let's get into it:
ASCII values 0β8, \x0β\x8, octal \0β\10, control codes (NUL, etc.)
- all classifications are
0(control codes aren't printing anything, they're just existing)
ASCII value 9, \x9, octal \11, tab (\t)
iscntrl:β 0isprint:0isspace:β 0isblank:β 0isgraph:0ispunct:0isalnum:0isalpha:0isupper:0islower:0isdigit:0isxdigit:0iswcntrl:0iswprint:0iswspace:β 0iswblank:β 0iswgraph:0iswpunct:0iswalnum:0iswalpha:0iswupper:0iswlower:0iswdigit:0iswxdigit:0
ASCII values 10β13, \xAβ\xD, octal \12β\15, whitespaces \n, \v, \f, \r
iscntrl:β 0isprint:0isspace:β 0isblank:0isgraph:0ispunct:0isalnum:0isalpha:0isupper:0islower:0isdigit:0isxdigit:0iswcntrl:0iswprint:0iswspace:β 0iswblank:0iswgraph:0iswpunct:0iswalnum:0iswalpha:0iswupper:0iswlower:0iswdigit:0iswxdigit:0
ASCII values 14β31, \xEβ\x1F, octal \16β\37, control codes
iscntrl:β 0isprint:0isspace:0isblank:0isgraph:0ispunct:0isalnum:0isalpha:0isupper:0islower:0isdigit:0isxdigit:0iswcntrl:0iswprint:0iswspace:0iswblank:0iswgraph:0iswpunct:0iswalnum:0iswalpha:0iswupper:0iswlower:0iswdigit:0iswxdigit:0
ASCII value 32, \x20, octal \40, space
iscntrl:0isprint:β 0isspace:β 0isblank:β 0isgraph:0ispunct:0isalnum:0isalpha:0isupper:0islower:0isdigit:0isxdigit:0iswcntrl:0iswprint:β 0iswspace:β 0iswblank:β 0iswgraph:0iswpunct:0iswalnum:0iswalpha:0iswupper:0iswlower:0iswdigit:0iswxdigit:0
ASCII values 33β47, \x21β\x2F, octal \41β\57, !"#$%&'()*+,-./
iscntrl:0isprint:β 0isspace:0isblank:0isgraph:β 0ispunct:β 0isalnum:0isalpha:0isupper:0islower:0isdigit:0isxdigit:0iswcntrl:0iswprint:0iswspace:0iswblank:0iswgraph:β 0iswpunct:β 0iswalnum:0iswalpha:0iswupper:0iswlower:0iswdigit:0iswxdigit:0
ASCII values 48β57, \x30β\x39, octal \60β\71, 0123456789
iscntrl:0isprint:β 0isspace:0isblank:0isgraph:β 0ispunct:0isalnum:β 0isalpha:0isupper:0islower:0isdigit:β 0isxdigit:β 0iswcntrl:0iswprint:β 0iswspace:0iswblank:0iswgraph:β 0iswpunct:0iswalnum:β 0iswalpha:0iswupper:0iswlower:0iswdigit:β 0iswxdigit:β 0
ASCII values 58β64, \x3Aβ\x40, octal \72β\100, :;<=>?@
iscntrl:0isprint:β 0isspace:0isblank:0isgraph:β 0ispunct:β 0isalnum:0isalpha:0isupper:0islower:0isdigit:0isxdigit:0iswcntrl:0iswprint:β 0iswspace:0iswblank:0iswgraph:β 0iswpunct:β 0iswalnum:0iswalpha:0iswupper:0iswlower:0iswdigit:0iswxdigit:0
ASCII values 65β70, \x41β\x46, octal \101β\106, ABCDEF
iscntrl:0isprint:β 0isspace:0isblank:0isgraph:β 0ispunct:0isalnum:β 0isalpha:β 0isupper:β 0islower:0isdigit:0isxdigit:β 0iswcntrl:0iswprint:β 0iswspace:0iswblank:0iswgraph:β 0iswpunct:0iswalnum:β 0iswalpha:β 0iswupper:β 0iswlower:0iswdigit:0iswxdigit:β 0
ASCII values 71β90, \x47β\x5A, octal \107β\132, GHIJKLMNOPQRSTUVWXYZ
iscntrl:0isprint:β 0isspace:0isblank:0isgraph:β 0ispunct:0isalnum:β 0isalpha:β 0isupper:β 0islower:0isdigit:0isxdigit:0iswcntrl:0iswprint:β 0iswspace:0iswblank:0iswgraph:β 0iswpunct:0iswalnum:β 0iswalpha:β 0iswupper:β 0iswlower:0iswdigit:0iswxdigit:0
ASCII values 91β96, \x5Bβ\x60, octal \133β\140, `[]^_``
iscntrl:0isprint:β 0isspace:0isblank:0isgraph:β 0ispunct:β 0isalnum:0isalpha:0isupper:0islower:0isdigit:0isxdigit:0iswcntrl:0iswprint:β 0iswspace:0iswblank:0iswgraph:β 0iswpunct:β 0iswalnum:0iswalpha:0iswupper:0iswlower:0iswdigit:0iswxdigit:0
ASCII values 97β102, \x61β\x66, octal \141β\146, abcdef
iscntrl:0isprint:β 0isspace:0isblank:0isgraph:β 0ispunct:0isalnum:β 0isalpha:β 0isupper:0islower:β 0isdigit:0isxdigit:β 0iswcntrl:0iswprint:β 0iswspace:0iswblank:0iswgraph:β 0iswpunct:0iswalnum:β 0iswalpha:β 0iswupper:0iswlower:β 0iswdigit:0iswxdigit:β 0
ASCII values 103β122, \x67β\x7A, octal \147β\172, ghijklmnopqrstuvwxyz
iscntrl:0isprint:β 0isspace:0isblank:0isgraph:β 0ispunct:0isalnum:β 0isalpha:β 0isupper:0islower:β 0isdigit:0isxdigit:0iswcntrl:0iswprint:β 0iswspace:0iswblank:0iswgraph:β 0iswpunct:0iswalnum:β 0iswalpha:β 0iswupper:0iswlower:β 0iswdigit:0iswxdigit:0
ASCII values 123β126, \x7Bβ\x7E, octal \172β\176, {|}~
iscntrl:0isprint:β 0isspace:0isblank:0isgraph:β 0ispunct:β 0isalnum:0isalpha:0isupper:0islower:0isdigit:0isxdigit:0iswcntrl:0iswprint:β 0iswspace:0iswblank:0iswgraph:β 0iswpunct:β 0iswalnum:0iswalpha:0iswupper:0iswlower:0iswdigit:0iswxdigit:0
ASCII value 127, \x7F, octal \177, backspace character (DEL)
iscntrl:β 0isprint:0isspace:0isblank:0isgraph:0ispunct:0isalnum:0isalpha:0isupper:0islower:0isdigit:0isxdigit:0iswcntrl:0iswprint:0iswspace:0iswblank:0iswgraph:0iswpunct:0iswalnum:0iswalpha:0iswupper:0iswlower:0iswdigit:0iswxdigit:0
So there you have it bestie β the whole std::iswxdigit moment. Every detail preserved, every vibe enhanced. Go forth and classify those wide characters with confidence. The hex digits are waiting and you're gonna slay it. πβ¨π
Source: cppreference.com, last updated 2024.06.10, std::iswxdigit(3) β go off bestie, periodt! π
π¦ 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