#pinyin #chinese #sentence #change #initial

rust-pinyin

Change chinese sentence to pinyin initials

4 releases

0.1.3 Nov 22, 2023
0.1.2 Nov 2, 2023
0.1.1 Sep 2, 2021
0.1.0 Sep 2, 2021

#195 in Internationalization (i18n)

MIT/Apache

24KB
52 lines

rust-pinyin

Change chinese sentence to pinyin initials

将汉字转成拼音首字母,用于自动完成的快捷拼音输入

Installation

Add this to your Cargo.toml:

[dependencies]
rust-pinyin = "0.1"

How to use:

use rust_pinyin::get_pinyin;

assert_eq!("zhq123vc", get_pinyin("张华强123vc"));
assert_eq!("bjyrysmyxgs", get_pinyin("北京益瑞盈商贸有限公司"));
assert_eq!("xnbjjsyxgs", get_pinyin("信念(北京)技术有限公司"));

No runtime deps