Java HTML Filter filterHtml(String s)

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

Description

filter Html

License

Apache License

Declaration

public static String filterHtml(String s) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static String filterHtml(String s) {
        if (s == null) {
            return null;
        }/*  ww w.j a v a  2 s  .c  o  m*/

        s = s.replaceAll("<", "");
        s = s.replaceAll(">", "");
        s = s.replaceAll(" ", "");
        s = s.replaceAll("(?s)<!--.*?-->", "");
        return s.replaceAll("(?s)<.*?>", "");
    }
}

Related

  1. filterHtml(String body)
  2. filterHTML(String input)
  3. filterHTML(String input)
  4. filterHtml(String input)
  5. filterHTML(String s)
  6. filterHtmlAndTruncate(String s)
  7. filterHtmlAndTruncate(String s)
  8. filterHtmlTag(String body)