c# 删除去掉全角空格

     public static string FullWidthToHalfWidth(string str)
        {
            byte[] t = Encoding.Default.GetBytes(str);
            for (int i = 0; i < t.Length; i++)
            {
                if ((t[i].ToString() == "161") && (t[i + 1].ToString() == "161"))
                {
                    t[i] = 32;
                    if (i + 1 == t.Length - 1)
                    {
                        t[i + 1] = 0;
                    }
                    else
                    {
                        for (int j = i + 1; j + 1 < t.Length; j++)
                        {
                            t[j] = t[j + 1];
                            if (j + 1 == t.Length - 1)
                            {
                                t[j + 1] = 0;
                            }
                        }
                    }
                }
            }
            return Encoding.Default.GetString(t);
        }
原文地址:https://www.cnblogs.com/yeye518/p/2231622.html