Skip to content

Unicode grapheme cluster segmentation (UAX #29) for strings in Rust.

Notifications You must be signed in to change notification settings

sbillig/rust-grapheme

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Note: This library has not been maintained in a while. You should probably be using the unicode-segmentation crate instead.

rust-grapheme

Unicode grapheme cluster segmentation (UAX #29) for strings in Rust.

Installation:

rust pkg install github.com/sbillig/rust-grapheme.git

Use:

extern mod grapheme;
use grapheme::GraphemeList;

fn main() {
    let s = "u\u0308\u00fc";

    let by = s.len();
    let ch = s.char_len();
    let cl = s.graphemes().len();

    println!("bytes: {}, chars: {}, clusters: {}", by, ch, cl);

    for c in s.graphemes() {
        // c is a str slice
        println!("{}", c);
    }
}

Output:

bytes: 5, chars: 3, clusters: 2
ü
ü

About

Unicode grapheme cluster segmentation (UAX #29) for strings in Rust.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published