HTML轉義JAVA代碼

 public static String html(String content) {  if(content==null) return "";             String html = content;       //    html = html.replace( "'", "&apos;");      html = html.replaceAll( "&", "&amp;");      html = html.replace( """, "&quot;");  //"      html = html.replace( "t", "&nbsp;&nbsp;");// 替換跳格      html = html.replace( " ", "&nbsp;");// 替換空格      html = html.replace("<", "&lt;");        html = html.replaceAll( ">", "&gt;");         return html;  }  
相關文章
相關標籤/搜索