![unicode-segmentation-badge] [![cat-text-processing-badge]][cat-text-processing]
unicode-segmentation
箱子的UnicodeSegmentation::graphemes
函数,可用来,从 UTF-8 字符串中,收集单个 Unicode 字形。
#[macro_use]
extern crate unicode_segmentation;
use unicode_segmentation::UnicodeSegmentation;
fn main() {
let name = "José Guimarães\r\n";
let graphemes = UnicodeSegmentation::graphemes(name, true)
.collect::<Vec<&str>>();
assert_eq!(graphemes[3], "é");
}