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

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