java转义HTML标签

 

    if(content==nullreturn "";       
    String html = content;
    html = StringUtils.replace(html, "'""'");
    html = StringUtils.replace(html, "\""""");
    html = StringUtils.replace(html, "\t""  ");// 替换跳格
    //html = StringUtils.replace(html, " ", " ");// 替换空格
    html = StringUtils.replace(html, "<""&lt;");
    html = StringUtils.replace(html, ">""&gt;");
    return html;

 

HTML标签转义方法 - java代码库 - 云代码 http://yuncode.net/code/c_50d01e073973762

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章