pub fn graphemes(s: &str) -> Vec<&str>Expand description
Returns all Unicode grapheme clusters in the input string, following UAX #29.
A grapheme cluster is the smallest unit of text that a user perceives as a single character. This function implements Unicode® Standard Annex #29, including support for extended grapheme clusters such as:
- Emoji ZWJ sequences (e.g., 👩❤️💋👨)
- Hangul syllables
- Combining accents (e.g., é)
This API is Unicode-compliant and suitable for user-facing string segmentation.
§Arguments
s– The input string to split.
§Returns
A Vec<&str> where each item is a Unicode grapheme cluster.
§Example
use runefix_core::graphemes;
let clusters = graphemes("Love👩❤️💋👨爱");
assert_eq!(clusters, vec!["L", "o", "v", "e", "👩❤️💋👨", "爱"]);