Crates.io | pinyin-order |
lib.rs | pinyin-order |
version | 0.1.2 |
source | src |
created_at | 2017-03-10 14:07:22.977079 |
updated_at | 2020-11-13 08:52:02.516275 |
description | A Rust library that helps sort a string vector by Pinyin. Rust 字符串向量按拼音排序 |
homepage | https://github.com/iovxw/pinyin-order |
repository | https://github.com/iovxw/pinyin-order |
max_upload_size | |
id | 8919 |
size | 930,345 |
Rust 字符串向量按拼音排序
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中文", "中国", "中文", "重工"]);
}
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.