#region 0.1 中文转到英文 + static string GetPinYing(string characters)
/// <summary>
/// 中文转到英文
/// </summary>
/// <param name="characters"></param>
/// <returns></returns>
public static string GetPinYing(string characters)
{
if (characters.Length != )
{
StringBuilder fullSpellBuild = new StringBuilder();
for (int i = ; i < characters.Length; i++)
{
//判断是否是中文
bool itemFlag = ChineseChar.IsValidChar(characters[i]);
if (itemFlag)
{
ChineseChar chineseChar = new ChineseChar(characters[i]);
foreach (string value in chineseChar.Pinyins)
{
if (!string.IsNullOrEmpty(value))
{
fullSpellBuild.Append(value.Remove(value.Length - , ));
break;
}
}
}
else
{
fullSpellBuild.Append(characters[i]);
}
}
return fullSpellBuild.ToString();
}
return "";
}
#endregion
需要添加ChnCharInfo.DLL