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;
                }
            }

  • 相关阅读:
    明白python文件如何组织,理解建立源文件
    Python特殊语法:filter、map、reduce、lambda [转]
    html标签属性大全
    使用Webdriver执行JS小结
    Sublime Text ——3200破解补丁
    JavaScript——JS屏蔽F12和右键
    Typecho——数据库无法连接问题
    vscode——配置git的path
    windows电脑连接蓝牙耳机的正确步骤
    eolinker——添加项目成员
  • 原文地址:https://www.cnblogs.com/lmcblog/p/2596514.html
Copyright © 2011-2022 走看看