using Microsoft.International.Converters.PinYinConverter;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Suspects.Dll.Util
{
publicclassPinYinUtil
{
//返回字符串的简拼
publicstaticstring getSimplePinYin(stringinputTxt)
{
string shortR ="";
foreach (char cin inputTxt.Trim())
{
ChineseChar chineseChar =newChineseChar(c);
shortR +=chineseChar.Pinyins[0].Substring(0, 1).ToLower();
}
return shortR;
}
//返回字符串全拼
publicstaticstring getAllPinYin(string inputTxt)
{
string allR ="";
foreach (char cin inputTxt.Trim())
{
ChineseChar chineseChar =newChineseChar(c);
allR += chineseChar.Pinyins[0].Substring(0,chineseChar.Pinyins[0].Length - 1).ToLower();
}
return allR;
}
}
}