GRAPHEME_NEXT_CHARACTER_BREAK(3)

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

πŸ’– NAME πŸ’–

Hiii bestie! πŸ’– This page lives in the Library Functions Manual, and the header title is GRAPHEME_NEXT_CHARACTER_(3). Today we're talking about grapheme_next_character_break() β€” your little helper for finding the next grapheme cluster break. 🫢

  • grapheme_next_character_break β€” determine the codepoint-offset to the next grapheme cluster break βœ¨πŸ’…

πŸ¦‹ SYNOPSIS πŸ¦‹

Okay, formal fit check time:

#include <grapheme.h>

size_t
grapheme_next_character_break(const uint_least32_t *str, size_t len);

✨ DESCRIPTION ✨

Okay so here's the tea: grapheme_next_character_break() computes the offset (in codepoints) to the next grapheme cluster break β€” peep libgrapheme(7) if you wanna know more β€” inside the codepoint array str of length len. If a grapheme cluster begins right at str, that offset is literally equal to the length of said grapheme cluster. πŸ’–

Now, if len is set to SIZE_MAX (stdint.h is already included by grapheme.h, no extra homework), then str is interpreted as NUL-terminated, and processing stops when it encounters a codepoint with the value 0. πŸ›‘

For UTF-8-encoded input data, bestie, you can use grapheme_next_character_break_utf8(3) instead. That's the sibling function. πŸ¦‹


πŸŽ€ RETURN VALUES πŸŽ€

grapheme_next_character_break() returns the offset (in codepoints) to the next grapheme cluster break in str, or 0 if str is NULL. That's the whole return vibe check. πŸŽ€


🌈 SEE ALSO 🌈

Go give these a look, iykyk:


⭐ STANDARDS ⭐

grapheme_next_character_break() is compliant with the Unicode 17.0.0 specification. Standards? Ate. ⭐


πŸ‘‘ AUTHORS πŸ‘‘

Shoutout to Laslo Hunhold <dev@frign.de> for this one. πŸ‘‘


Cute little sign-off: this page's source/version is suckless.org, and it's dated 2022-10-06. The page title is GRAPHEME_NEXT_CHARACTER_BREAK(3). Mwah πŸ’‹

πŸ“¦ where this page comes from