文件名称:微软类库,获取汉字的拼音缩写
文件大小:2.38MB
文件格式:RAR
更新时间:2013-06-13 07:16:42
拼音缩写 微软
CHSPinYinConv.msi就是汉字拼音相关的,CHTCHSConv.msi是进行 简体与繁体进行相互转换的 安装完毕后,需要在VS里添加引用,分别引用:C:\Program Files\Microsoft Visual Studio International Pack\Simplified Chinese Pin-Yin Conversion Library下和C:\Program Files\Microsoft Visual Studio International Pack\Traditional Chinese to Simplified Chinese Conversion Library and Add-In Tool下的dll即可使用。 代码: using Microsoft.International.Converters.PinYinConverter; using Microsoft.International.Converters.TraditionalChineseToSimplifiedConverter; public static string GetPinyin(string str) { string r = string.Empty; foreach (char obj in str) { try { ChineseChar chineseChar = new ChineseChar(obj); string t = chineseChar.Pinyins[0].ToString(); r += t.Substring(0, t.Length - 1); } catch { r += obj.ToString(); } } return r; } public static string GetShortPinyin(string str) { string r = string.Empty; foreach (char obj in str) { try { ChineseChar chineseChar = new ChineseChar(obj); string t = chineseChar.Pinyins[0].ToString(); r += t.Substring(0, 1); } catch { r += obj.ToString(); } } return r; } 调用: GetPinyin("全拼 瘦痩龙"); GetShortPinyin("首字符 瘦痩龙");
【文件预览】:
CHTCHSConv.msi
CHSPinYinConv.msi