Beispiel #1
0
 /// <summary>
 /// 字符串转为繁体字
 /// </summary>
 /// <param name="str">简体中文字符串</param>
 /// <returns>繁体中文字符串</returns>
 public string StringToTraditional(string str, bool useChineseConverClass = true)
 {
     try
     {
         if (useChineseConverClass)
         {
             return(ChineseConvert.ToTraditional(str));
         }
         else
         {
             return(Microsoft.VisualBasic.Strings.StrConv(str, Microsoft.VisualBasic.VbStrConv.TraditionalChinese, 0));
         }
     }
     catch (Exception)
     {
         return("");
     }
 }
Beispiel #2
0
        /// <summary>
        /// 字符串转为繁体字
        /// </summary>
        /// <param name="str">简体中文字符串</param>
        /// <returns>繁体中文字符串</returns>
        public string StringToTraditional(string str, enumConvertOption convertOption = enumConvertOption.OldWord)
        {
            try
            {
                switch (convertOption)
                {
                case enumConvertOption.Quick:
                    return(Microsoft.VisualBasic.Strings.StrConv(str, Microsoft.VisualBasic.VbStrConv.TraditionalChinese, 0));

                case enumConvertOption.OldWord:
                    return(ChineseConvert.ToTraditional(str));

                case enumConvertOption.High:
                    return(HighConvert.Chs2Cht(str));

                default:
                    return("");
                }
            }
            catch (Exception)
            {
                return("");
            }
        }