汉字转全拼,简拼组件

http://www.cnblogs.com/msnadair/archive/2009/04/19/1439324.html

或者使用微软组件。只能获取单个汉字的所有拼音读法、音调。

Microsoft Visual Studio International Pack 1.0,多音字、笔画、同音字这些功能都有的。https://www.microsoft.com/downloads/details.aspx?FamilyID=44cac7f0-633b-477d-aed2-99aee642fc10&displaylang=zh-cn

测试结果:

 1         using Microsoft.International.Converters.PinYinConverter;
 2          //测试结果
 3         //钮=》NIU3
 4         //了=》LE5LIAO3
 5         //非中文字符,比如:l或4=》抛出异常:该字符不属于简体中文扩展字符集
 6         //要实现对某一含中文的字符串取首字母:foreach每个char,if(IsChineseChar(ch)){取该ch的第一个拼音} else {直接使用ch}
 7         public void TestChineseToPinyin(char chineseChar)
 8         {
 9             ChineseChar ch = new ChineseChar(chineseChar);
10             //Response.Write(ch.ChineseCharacter);  //原字符
11             foreach (string pinyin in ch.Pinyins)   //拼音集合
12             {
13                 Response.Write(pinyin);
14             }
15         }
View Code

另外还有Microsoft Visual Studio International Pack 2.0,不过没有实际意义。https://www.microsoft.com/zh-cn/download/details.aspx?id=18970

原文地址:https://www.cnblogs.com/nlh774/p/7599233.html