#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

#203 in Internationalization (i18n)

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

~10KB