Java HTML Filter filterHtml(String body)

Here you can find the source of filterHtml(String body)

Description

filter Html

License

Open Source License

Declaration

public static String filterHtml(String body) 

Method Source Code

//package com.java2s;

public class Main {
    public static String filterHtml(String body) {
        if (body == null) {
            return "";
        }//  www. ja va 2s  .c o  m
        body = body.replace(" ", "&nbsp;").replace("\r", "<BR/>").replace("\n", "<BR/>").replaceAll("<", "&lt;")
                .replaceAll(">", "&gt;").replaceAll("\"", "&quot;").replaceAll("'", "&quot;");
        return body;
    }
}

Related

  1. filterHtml(String input)
  2. filterHTML(String input)
  3. filterHTML(String input)
  4. filterHTML(String s)