C#实现简体繁体转换代码示例
//簡體轉(zhuǎn)繁體
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);
}
//繁體轉(zhuǎn)簡體
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
總結(jié)
以上是生活随笔為你收集整理的C#实现简体繁体转换代码示例的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: js获取用户当前所在城市(ip)
- 下一篇: EditPlus批量转码