#pinyin #string #convert #bopomofo

to_bopomofo

Converts a pinyin string to a Bopomofo string

3 releases

0.1.2 Jan 23, 2024
0.1.1 Jan 23, 2024
0.1.0 Jan 23, 2024

#98 in Internationalization (i18n)

39 downloads per month

MIT license

18KB
439 lines

to_bopomofo

Converts a pinyin string to a Bopomofo string

install

cargo add to_bopomofo

use

use to_bopomofo::to_bopomofo;

fn main() {
    let bopomofo1 = to_bopomofo("ni");
    println!("bopomofo:{bopomofo1:?}"); // bopomofo:Some("ㄋㄧ")
    let bopomofo2 = to_bopomofo("wrong pinyin");
    println!("bopomofo:{bopomofo2:?}"); // bopomofo:None
}

Dependencies

~11KB