zoukankan      html  css  js  c++  java
  • 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);
            }
  • 相关阅读:
    最大流最小割——bzoj1001狼抓兔子,洛谷P2598
    求最小公因数和最大公倍数
    归并排序
    Splay
    Tarjan判断为什么不能把dfn写成low
    2-SAT问题
    离散数学-传递闭包(POJ3275)
    POJ3190
    安装环境gcc;
    二分折半排序
  • 原文地址:https://www.cnblogs.com/yeye518/p/2231622.html
Copyright © 2011-2022 走看看