std::iswlower(3)

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

okay so bestie, we’re opening up std::iswlower(3) from the C++ Standard Libary (yes, that’s the header’s spelling β€” I’m just the messenger πŸ’€). this page is literally a vibe check for wide lowercase letters, and it is lowkey iconic. let’s get into it.

πŸ’– NAME πŸ’–

std::iswlower β€” and the source NAME line is literally std::iswlower - std::iswlower, which is giving β€œI said what I said” energy. it checks wide characters for lowercase-ness.

🌸 Synopsis 🌸

defined in header <cwctype>

int iswlower( std::wint_t ch );

this function checks if the given wide character is a lowercase letter, aka one of abcdefghijklmnopqrstuvwxyz or any lowercase letter specific to the current locale. periodt.

⚠️ undefined behavior alert: 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. no cap, don’t test it.

πŸŽ€ Parameters πŸŽ€

  • ch β€” a wide character. that’s the whole parameter, bestie.

✨ Return value ✨

  • Non-zero value if the wide character is a lowercase letter. πŸ’–
  • zero otherwise. that’s it, that’s the return.

πŸ¦‹ Notes πŸ¦‹

ISO 30112 specifies which Unicode characters are included in the POSIX lower category. so if you’re wondering why some Unicode letters get the lowercase crown πŸ‘‘, that’s the standard doing its thing.

πŸ“ Example πŸ“

// Run this code

#include <clocale>
#include <cwctype>
#include <iostream>

int main()
{
    wchar_t c = L'\u0444'; // Cyrillic small letter ef ('Ρ„')

    std::cout << std::hex << std::showbase << std::boolalpha
              << "in the default locale, iswlower("
              << static_cast<std::wint_t>(c) << ") = "
              << static_cast<bool>(std::iswlower(c)) << '\n';

    std::setlocale(LC_ALL, "en_US.utf8");
    std::cout << "in Unicode locale, iswlower("
              << static_cast<std::wint_t>(c) << ") = "
              << static_cast<bool>(std::iswlower(c)) << '\n';
}

🌈 Output 🌈

in the default locale, iswlower(0x444) = false
in Unicode locale, iswlower(0x444) = true

πŸ‘‘ See also πŸ‘‘

  • islower(std::locale) β€” checks if a character is classified as lowercase by a locale (function template).
  • islower β€” checks if a character is lowercase (function).
  • C documentation for iswlower β€” yes, the C version also exists, iykyk.

also the original page has this giant ASCII values/classification chart at the bottom, and I am not skipping it. here’s the whole thing, preserved in its original wrapped, chaotic layout β€” the formatting is giving β€œmanpage extraction went feral” πŸ’€:

               ASCII values            characters    iscntrl  isprint  isspace
       isblank  isgraph  ispunct  isalnum  isalpha  isupper  islower  isdigit
       isxdigit decimal hexadecimal   octal                   iswcntrl iswprint
       iswspace iswblank iswgraph iswpunct iswalnum iswalpha iswupper iswlower
       iswdigit iswxdigit 0–8     \x0–\x8     \0–\10    control codes   β‰ 0
       0        0        0        0        0        0        0        0
       0        0        0
                                     (NUL, etc.)  9       \x9         \11
       tab (\t)        β‰ 0       0        β‰ 0       β‰ 0       0        0        0
       0        0        0        0        0
                                     whitespaces 10–13   \xA–\xD     \12–\15
       (\n, \v, \f,    β‰ 0       0        β‰ 0       0        0        0        0
       0        0        0        0        0
                                     \r) 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
       GHIJKLMNOP      0        β‰ 0       0        0        β‰ 0       0        β‰ 0
       β‰ 0       β‰ 0       0        0        0
                                     QRSTUVWXYZ 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
       ghijklmnop      0        β‰ 0       0        0        β‰ 0       0        β‰ 0
       β‰ 0       0        β‰ 0       0        0
                                     qrstuvwxyz 123–126 \x7B–\x7E   \172–\176
       {|}~            0        β‰ 0       0        0        β‰ 0       β‰ 0       0
       0        0        0        0        0 127     \x7F        \177
       backspace       β‰ 0       0        0        0        0        0        0
       0        0        0        0        0
                                     character (DEL)

made with πŸ’– by http://cppreference.com Β· page date 2024.06.10 Β· manual std::iswlower(3) β€” slay, you made it to the end. 🫢

πŸ“¦ where this page comes from