zoukankan      html  css  js  c++  java
  • 过滤特殊字符

     /// <summary>
            /// 过滤特殊字符
            /// </summary>
            /// <param name="str"></param>
            /// <returns></returns>
            public static string FilterSpecial(this string str)
            {
                if (str == string.Empty) //如果字符串为空,直接返回。
                {
                    return str;
                }
                else
                {
                    str = str.Replace("'", string.Empty);
                    str = str.Replace("<", string.Empty);
                    str = str.Replace(">", string.Empty);
                    //str = str.Replace("%", string.Empty);
                    str = str.Replace("'delete", string.Empty);
                    str = str.Replace("''", string.Empty);
                    str = str.Replace(",", string.Empty);
                    str = str.Replace(".", string.Empty);
                    str = str.Replace(">=", string.Empty);
                    str = str.Replace("=<", string.Empty);
                    str = str.Replace("-", string.Empty);
                    str = str.Replace("_", string.Empty);
                    str = str.Replace(";", string.Empty);
                    str = str.Replace("||", string.Empty);
                    str = str.Replace("[", string.Empty);
                    str = str.Replace("]", string.Empty);
                    str = str.Replace("&", string.Empty);
                    str = str.Replace("/", string.Empty);
                    str = str.Replace("-", string.Empty);
                    str = str.Replace("|", string.Empty);
                    str = str.Replace("?", string.Empty);
                    str = str.Replace(">?", string.Empty);
                    str = str.Replace("?<", string.Empty);
                    str = str.Replace(" ", string.Empty);
                    return str;
                }
            }

  • 相关阅读:
    汇编语言从入门到精通-指令汇总
    汇编语言从入门到精通-5微机CPU的指令系统1
    两台W7系统的电脑,A电脑可以ping通B电脑,B电脑ping不通A电脑。
    linux与python3安装redis
    python3报:ImportError: No module named 'MySQLdb'
    Django安装数据库MySQLdb
    win7系统中开启wifi热点
    以太坊
    route命令
    Android——UI(1) (activity window decor)
  • 原文地址:https://www.cnblogs.com/lmcblog/p/2596514.html
Copyright © 2011-2022 走看看