GRAPHEME_TO_LOWERCASE_UTF8(3)

πŸ“¦ version 3.0.0, in nixos 26.05, nixpkgs unstable

πŸ’… GRAPHEME_TO_LOWERCASE_UTF8(3) πŸ’…

okay so bestie, this one lives in the Library Functions Manual, section 3, and the whole personality is grapheme_to_lowercase_utf8 β€” yes the header up there is a lil truncated (GRAPHEME_TO_LOWERCASE_UT) but we know her πŸ’–


✨ NAME ✨

grapheme_to_lowercase_utf8 β€” convert a UTF-8-encoded string to lowercase, no cap 🫢


🌸 SYNOPSIS 🌸

#include <grapheme.h>

size_t
grapheme_to_lowercase_utf8(const char *src, size_t srclen, char *dest,
    size_t destlen);

πŸ¦‹ DESCRIPTION πŸ¦‹

so the grapheme_to_lowercase_utf8() function converts the UTF-8-encoded string str to lowercase and writes the result into dest, up to destlen β€” unless dest is set to NULL, in which case she's just doing the math, not the writing πŸ™ˆ

if srclen is set to SIZE_MAX (and yes, stdint.h is already included by grapheme.h, so you don't gotta do anything πŸ’…), then the UTF-8-encoded string src is interpreted as being NUL-terminated, and processing stops the moment a NUL-byte is encountered. iconic behavior honestly.

for non-UTF-8 input data, grapheme_to_lowercase(3) can be used instead β€” she's the sibling for that ✨


⭐ RETURN VALUES ⭐

grapheme_to_lowercase_utf8() returns the number of bytes in the array that results from converting src to lowercase β€” and she returns that number even if destlen is not large enough or dest is NULL. like she always tells you how much space you would've needed, no gatekeeping πŸ”₯


πŸŽ€ SEE ALSO πŸŽ€


πŸ‘‘ STANDARDS πŸ‘‘

grapheme_to_lowercase_utf8() is compliant with the Unicode 17.0.0 specification. periodt. 🌈


πŸ“ AUTHORS πŸ“

Laslo Hunhold <dev@frign.de> β€” thank you for your service 🫢


ngl if you're passing a destlen that's too small, she's still gonna tell you the real size, so vibe check your buffers before you copy anything in, bestie πŸ’€

written with love by the lovely humans at suckless.org, dated 2022-10-06, and this whole page is literally GRAPHEME_TO_LOWERCASE_UTF8(3) β€” mwah, bye bestie πŸ’œπŸ§šβ€β™€οΈ

πŸ“¦ where this page comes from