#order #sorting #pinyin #chinese #hanzi

pinyin-order

A Rust library that helps sort a string vector by Pinyin. Rust 字符串向量按拼音排序

3 releases

Uses old Rust 2015

0.1.2 Nov 13, 2020
0.1.1 Mar 11, 2017
0.1.0 Mar 10, 2017

#348 in Internationalization (i18n)

23 downloads per month

Unlicense

335KB
92 lines

Deprecated: The pinyin crate has been rewritten, use it instead.

pinyin-order

Travis Build Status Crates Documentation

Rust 字符串向量按拼音排序

Example

extern crate pinyin_order;

use pinyin_order::as_pinyin;

fn main() {
    let mut l = vec!["中文", "中国", "abc", "重工", "abc中文"];
    l.sort_by_key(|s| as_pinyin(s));
    assert_eq!(l, vec!["abc", "abc中文", "中国", "中文", "重工"]);
}

License

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

Dependencies