清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
这两个C#函数分别用于将半角字符转换成全角字符和将全角字符转换成半角字符,调用简单
/// <summary> /// 转全角的函数(SBC case) /// </summary> /// <param name="input"></param> /// <returns></returns> public static string ToSBC(string input) { //半角转全角: char[] c = input.ToCharArray(); for (int i = 0; i < c.Length; i++) { if (c[i] == 32) { c[i] = (char)12288; continue; } if (c[i] < 127) c[i] = (char)(c[i] + 65248); } return new string(c); } /// <summary> /// 转半角的函数(SBC case) /// </summary> /// <param name="input">输入</param> /// <returns></returns> public static string ToDBC(string input) { char[] c = input.ToCharArray(); for (int i = 0; i < c.Length; i++) { if (c[i] == 12288) { c[i] = (char)32; continue; } if (c[i] > 65280 && c[i] < 65375) c[i] = (char)(c[i] - 65248); } return new string(c); }