1. 程式人生 > >C#簡繁體轉換

C#簡繁體轉換

html com 字符串 ... https ngs mar cli 右擊

/// <summary>
/// 字符串簡體轉繁體
/// </summary>
/// <param name="strSimple"></param>
/// <returns></returns>
public static string ToTraditionalChinese(string strSimple)
{
string strTraditional = Microsoft.VisualBasic.Strings.StrConv(strSimple, Microsoft.VisualBasic.VbStrConv.TraditionalChinese, 0);
return strTraditional;
}

/// <summary>
/// 字符串繁體轉簡體
/// </summary>
/// <param name="strTraditional"></param>
/// <returns></returns>
public static string ToSimplifiedChinese(string strTraditional)
{
string strSimple = Microsoft.VisualBasic.Strings.StrConv(strTraditional, VbStrConv.SimplifiedChinese, 0);
return strSimple;
}

找不到Microsoft.VisualBasic解決方法:
右擊項目:點擊[添加引用]。把這個 Microsoft.VisualBasic...引用到項目

出自:https://www.cnblogs.com/Clin/archive/2013/03/14/2959280.html

C#簡繁體轉換