C#实现简体繁体转换代码示例
//簡體轉繁體
public static string _ConvertChinTrad(string strInput)
{
? ? EncodeRobert edControl = new EncodeRobert();
? ? string strResult = "";
? ? if (strInput == null)
? ? ? ? return strResult;
? ? if (strInput.ToString().Length >= 1)
? ? ? ? strResult = edControl.SCTCConvert(ConvertType.Simplified, ConvertType.Traditional, strInput);
? ? else
? ? ? ? strResult = strInput;
? ? return new string(strResult);
}
//繁體轉簡體
public static string _ConvertChinSimp(string strInput)
{
? ? EncodeRobert edControl = new EncodeRobert();
? ? string strResult = "";
? ? if (strInput.Length >= 1)
? ? ? ? strResult = edControl.SCTCConvert(ConvertType.Traditional, ConvertType.Simplified, strInput);
? ? else
? ? ? ? strResult = strInput;
? ? return new string(strResult);
}
說明:要引用Encode.dll
總結
以上是生活随笔為你收集整理的C#实现简体繁体转换代码示例的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: js获取用户当前所在城市(ip)
- 下一篇: C#通过SMTP发送邮件代码示例