Dian.Pinyin4net can help you convert 中文 to zhōng wén.
using Pinyin4net;
...
string[] pinyinStr = PinyinHelper.ToHanyuPinyinStringArray(someChineseChar);
...
string pinyinStr = PinyinHelper.ToFirstLetter(someChineseString);
string pinyinStr = PinyinHelper.ToFullLetter(someChineseString);
...
- Convert Chinese to Hanyu Pinyin system.
- Support both Simplified Chinese and Tranditional Chinese.
- Multiple options for output format
All uppercase or lowercase
Can out put Unicode ü or v or u:
With tone numbers (lü3) or tone marks (lǚ) or without tone (lü)
Plesae see https://www.nuget.org/packages/Dian.Pinyin4net
Most code of pinyin4net is based on the code of project pinyin4j.
Thanks Li Min for the great code ^_^.
Have a bug? Please create an issue here on GitHub!
https://github.com/mybbcat/diandi.pinyin4net/issues
Dian.Pinyin4net is released under the MIT licence: