现在的位置: 首页 > 综合 > 正文

java过滤http危险字符

2013年08月14日 ⁄ 综合 ⁄ 共 370字 ⁄ 字号 评论关闭

//过滤危险字符

    public static final String filterStr(String str){

        str=str.replaceAll(";","");

        str=str.replaceAll("&","&");

        str=str.replaceAll("<","<");

        str=str.replaceAll(">",">");

        str=str.replaceAll("'","");

        str=str.replaceAll("--"," ");

        str=str.replaceAll("/","");

        str=str.replaceAll("%","");

        return str;

    }

抱歉!评论已关闭.