Function voca_rs::count::count_graphemes

source ·
pub fn count_graphemes(subject: &str) -> usize
Expand description

Counts the graphemes in subject taking care of surrogate pairs and combining marks.

Arguments

  • subject - The string to count graphemes.

Example

use voca_rs::*;
count::count_graphemes("cafe\u{0301}"); // or "café"
// => 4
count::count_graphemes("b\u{0142}\u{0105}d"); // or "błąd"
// => 4
count::count_graphemes("a̐éö̲");
// => 3
count::count_graphemes("rain");
// => 4
use voca_rs::Voca;
"cafe\u{0301}"._count_graphemes(); // or "café"
// => 4