C# 中文简繁转换

1.简繁转换引用的是Microsoft.VisualBasic程序集;

2.代码如下:

        /// <summary>
        /// 中文简繁转换
        /// </summary>
        /// <param name="x">中文</param>
        /// <param name="type">0.转繁体  1.转简体</param>
        /// <returns></returns>
        public static string StringConvert(string x, int type)
        {
            var value = string.Empty;
            switch (type)
            {
                case 0://转繁体
                    value = Microsoft.VisualBasic.Strings.StrConv(x, Microsoft.VisualBasic.VbStrConv.TraditionalChinese, 0);
                    break;
                case 1://转简体
                    value = Microsoft.VisualBasic.Strings.StrConv(x, Microsoft.VisualBasic.VbStrConv.SimplifiedChinese, 0);
                    break;
            }
            return value;
        }

 

上一篇:MYSQL:SELECT方法 – 但不显示重复/ GROUP或DISTINCT?


下一篇:Eyeglasses 3D shape reconstruction from a single face image