std::iswxdigit(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

✨ 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 of ch is neither representable as a wchar_t nor equal to the value of the macro WEOF, 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: β‰ 0
  • isprint: 0
  • isspace: β‰ 0
  • isblank: β‰ 0
  • isgraph: 0
  • ispunct: 0
  • isalnum: 0
  • isalpha: 0
  • isupper: 0
  • islower: 0
  • isdigit: 0
  • isxdigit: 0
  • iswcntrl: 0
  • iswprint: 0
  • iswspace: β‰ 0
  • iswblank: β‰ 0
  • iswgraph: 0
  • iswpunct: 0
  • iswalnum: 0
  • iswalpha: 0
  • iswupper: 0
  • iswlower: 0
  • iswdigit: 0
  • iswxdigit: 0

ASCII values 10–13, \xA–\xD, octal \12–\15, whitespaces \n, \v, \f, \r

  • iscntrl: β‰ 0
  • isprint: 0
  • isspace: β‰ 0
  • isblank: 0
  • isgraph: 0
  • ispunct: 0
  • isalnum: 0
  • isalpha: 0
  • isupper: 0
  • islower: 0
  • isdigit: 0
  • isxdigit: 0
  • iswcntrl: 0
  • iswprint: 0
  • iswspace: β‰ 0
  • iswblank: 0
  • iswgraph: 0
  • iswpunct: 0
  • iswalnum: 0
  • iswalpha: 0
  • iswupper: 0
  • iswlower: 0
  • iswdigit: 0
  • iswxdigit: 0

ASCII values 14–31, \xE–\x1F, octal \16–\37, control codes

  • iscntrl: β‰ 0
  • isprint: 0
  • isspace: 0
  • isblank: 0
  • isgraph: 0
  • ispunct: 0
  • isalnum: 0
  • isalpha: 0
  • isupper: 0
  • islower: 0
  • isdigit: 0
  • isxdigit: 0
  • iswcntrl: 0
  • iswprint: 0
  • iswspace: 0
  • iswblank: 0
  • iswgraph: 0
  • iswpunct: 0
  • iswalnum: 0
  • iswalpha: 0
  • iswupper: 0
  • iswlower: 0
  • iswdigit: 0
  • iswxdigit: 0

ASCII value 32, \x20, octal \40, space

  • iscntrl: 0
  • isprint: β‰ 0
  • isspace: β‰ 0
  • isblank: β‰ 0
  • isgraph: 0
  • ispunct: 0
  • isalnum: 0
  • isalpha: 0
  • isupper: 0
  • islower: 0
  • isdigit: 0
  • isxdigit: 0
  • iswcntrl: 0
  • iswprint: β‰ 0
  • iswspace: β‰ 0
  • iswblank: β‰ 0
  • iswgraph: 0
  • iswpunct: 0
  • iswalnum: 0
  • iswalpha: 0
  • iswupper: 0
  • iswlower: 0
  • iswdigit: 0
  • iswxdigit: 0

ASCII values 33–47, \x21–\x2F, octal \41–\57, !"#$%&'()*+,-./

  • iscntrl: 0
  • isprint: β‰ 0
  • isspace: 0
  • isblank: 0
  • isgraph: β‰ 0
  • ispunct: β‰ 0
  • isalnum: 0
  • isalpha: 0
  • isupper: 0
  • islower: 0
  • isdigit: 0
  • isxdigit: 0
  • iswcntrl: 0
  • iswprint: 0
  • iswspace: 0
  • iswblank: 0
  • iswgraph: β‰ 0
  • iswpunct: β‰ 0
  • iswalnum: 0
  • iswalpha: 0
  • iswupper: 0
  • iswlower: 0
  • iswdigit: 0
  • iswxdigit: 0

ASCII values 48–57, \x30–\x39, octal \60–\71, 0123456789

  • iscntrl: 0
  • isprint: β‰ 0
  • isspace: 0
  • isblank: 0
  • isgraph: β‰ 0
  • ispunct: 0
  • isalnum: β‰ 0
  • isalpha: 0
  • isupper: 0
  • islower: 0
  • isdigit: β‰ 0
  • isxdigit: β‰ 0
  • iswcntrl: 0
  • iswprint: β‰ 0
  • iswspace: 0
  • iswblank: 0
  • iswgraph: β‰ 0
  • iswpunct: 0
  • iswalnum: β‰ 0
  • iswalpha: 0
  • iswupper: 0
  • iswlower: 0
  • iswdigit: β‰ 0
  • iswxdigit: β‰ 0

ASCII values 58–64, \x3A–\x40, octal \72–\100, :;<=>?@

  • iscntrl: 0
  • isprint: β‰ 0
  • isspace: 0
  • isblank: 0
  • isgraph: β‰ 0
  • ispunct: β‰ 0
  • isalnum: 0
  • isalpha: 0
  • isupper: 0
  • islower: 0
  • isdigit: 0
  • isxdigit: 0
  • iswcntrl: 0
  • iswprint: β‰ 0
  • iswspace: 0
  • iswblank: 0
  • iswgraph: β‰ 0
  • iswpunct: β‰ 0
  • iswalnum: 0
  • iswalpha: 0
  • iswupper: 0
  • iswlower: 0
  • iswdigit: 0
  • iswxdigit: 0

ASCII values 65–70, \x41–\x46, octal \101–\106, ABCDEF

  • iscntrl: 0
  • isprint: β‰ 0
  • isspace: 0
  • isblank: 0
  • isgraph: β‰ 0
  • ispunct: 0
  • isalnum: β‰ 0
  • isalpha: β‰ 0
  • isupper: β‰ 0
  • islower: 0
  • isdigit: 0
  • isxdigit: β‰ 0
  • iswcntrl: 0
  • iswprint: β‰ 0
  • iswspace: 0
  • iswblank: 0
  • iswgraph: β‰ 0
  • iswpunct: 0
  • iswalnum: β‰ 0
  • iswalpha: β‰ 0
  • iswupper: β‰ 0
  • iswlower: 0
  • iswdigit: 0
  • iswxdigit: β‰ 0

ASCII values 71–90, \x47–\x5A, octal \107–\132, GHIJKLMNOPQRSTUVWXYZ

  • iscntrl: 0
  • isprint: β‰ 0
  • isspace: 0
  • isblank: 0
  • isgraph: β‰ 0
  • ispunct: 0
  • isalnum: β‰ 0
  • isalpha: β‰ 0
  • isupper: β‰ 0
  • islower: 0
  • isdigit: 0
  • isxdigit: 0
  • iswcntrl: 0
  • iswprint: β‰ 0
  • iswspace: 0
  • iswblank: 0
  • iswgraph: β‰ 0
  • iswpunct: 0
  • iswalnum: β‰ 0
  • iswalpha: β‰ 0
  • iswupper: β‰ 0
  • iswlower: 0
  • iswdigit: 0
  • iswxdigit: 0

ASCII values 91–96, \x5B–\x60, octal \133–\140, `[]^_``

  • iscntrl: 0
  • isprint: β‰ 0
  • isspace: 0
  • isblank: 0
  • isgraph: β‰ 0
  • ispunct: β‰ 0
  • isalnum: 0
  • isalpha: 0
  • isupper: 0
  • islower: 0
  • isdigit: 0
  • isxdigit: 0
  • iswcntrl: 0
  • iswprint: β‰ 0
  • iswspace: 0
  • iswblank: 0
  • iswgraph: β‰ 0
  • iswpunct: β‰ 0
  • iswalnum: 0
  • iswalpha: 0
  • iswupper: 0
  • iswlower: 0
  • iswdigit: 0
  • iswxdigit: 0

ASCII values 97–102, \x61–\x66, octal \141–\146, abcdef

  • iscntrl: 0
  • isprint: β‰ 0
  • isspace: 0
  • isblank: 0
  • isgraph: β‰ 0
  • ispunct: 0
  • isalnum: β‰ 0
  • isalpha: β‰ 0
  • isupper: 0
  • islower: β‰ 0
  • isdigit: 0
  • isxdigit: β‰ 0
  • iswcntrl: 0
  • iswprint: β‰ 0
  • iswspace: 0
  • iswblank: 0
  • iswgraph: β‰ 0
  • iswpunct: 0
  • iswalnum: β‰ 0
  • iswalpha: β‰ 0
  • iswupper: 0
  • iswlower: β‰ 0
  • iswdigit: 0
  • iswxdigit: β‰ 0

ASCII values 103–122, \x67–\x7A, octal \147–\172, ghijklmnopqrstuvwxyz

  • iscntrl: 0
  • isprint: β‰ 0
  • isspace: 0
  • isblank: 0
  • isgraph: β‰ 0
  • ispunct: 0
  • isalnum: β‰ 0
  • isalpha: β‰ 0
  • isupper: 0
  • islower: β‰ 0
  • isdigit: 0
  • isxdigit: 0
  • iswcntrl: 0
  • iswprint: β‰ 0
  • iswspace: 0
  • iswblank: 0
  • iswgraph: β‰ 0
  • iswpunct: 0
  • iswalnum: β‰ 0
  • iswalpha: β‰ 0
  • iswupper: 0
  • iswlower: β‰ 0
  • iswdigit: 0
  • iswxdigit: 0

ASCII values 123–126, \x7B–\x7E, octal \172–\176, {|}~

  • iscntrl: 0
  • isprint: β‰ 0
  • isspace: 0
  • isblank: 0
  • isgraph: β‰ 0
  • ispunct: β‰ 0
  • isalnum: 0
  • isalpha: 0
  • isupper: 0
  • islower: 0
  • isdigit: 0
  • isxdigit: 0
  • iswcntrl: 0
  • iswprint: β‰ 0
  • iswspace: 0
  • iswblank: 0
  • iswgraph: β‰ 0
  • iswpunct: β‰ 0
  • iswalnum: 0
  • iswalpha: 0
  • iswupper: 0
  • iswlower: 0
  • iswdigit: 0
  • iswxdigit: 0

ASCII value 127, \x7F, octal \177, backspace character (DEL)

  • iscntrl: β‰ 0
  • isprint: 0
  • isspace: 0
  • isblank: 0
  • isgraph: 0
  • ispunct: 0
  • isalnum: 0
  • isalpha: 0
  • isupper: 0
  • islower: 0
  • isdigit: 0
  • isxdigit: 0
  • iswcntrl: 0
  • iswprint: 0
  • iswspace: 0
  • iswblank: 0
  • iswgraph: 0
  • iswpunct: 0
  • iswalnum: 0
  • iswalpha: 0
  • iswupper: 0
  • iswlower: 0
  • iswdigit: 0
  • iswxdigit: 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