#pinyin #hanzi #Chinese #sort #order

pinyin-order

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

2 releases

0.1.1 Mar 11, 2017
0.1.0 Mar 10, 2017

#6 in Localization (L10n)

Download history 11/week @ 2018-05-04 14/week @ 2018-05-11 15/week @ 2018-05-18 15/week @ 2018-05-25 25/week @ 2018-06-01 10/week @ 2018-06-08 29/week @ 2018-06-15 8/week @ 2018-06-22 26/week @ 2018-06-29 115/week @ 2018-07-06 185/week @ 2018-07-13 27/week @ 2018-07-20 16/week @ 2018-07-27

75 downloads per month

Unlicense

330KB
92 lines

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.


lib.rs:

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中文", "中国", "中文", "重工"]);
}

Dependencies