List of utility methods to do HTML to String
String | toText(String html) to Text String newline = System.getProperty("line.separator"); return html == null ? "" : html.replaceAll("<br/>", newline).replaceAll("<ul>", newline + newline) .replaceAll("</ul>", newline).replaceAll("<li>", "* ").replaceAll("</li>", newline); |
String | toText(String html) Extract the HTML tags from the given input to make the text content more readable. String newline = System.getProperty("line.separator"); return html == null ? "" : html.replaceAll("<br/>", newline).replaceAll("<ul>", newline + newline) .replaceAll("</ul>", newline).replaceAll("<li>", "* ").replaceAll("</li>", newline); |
String | toText(String text) to Text char[] buf = text.toCharArray(); StringBuilder b = new StringBuilder(text.length()); int idx = 0; while (idx < buf.length) { if (buf[idx] == '<') { int endTagPos = 0; if (idx + 2 < buf.length && buf[idx + 1] == '!' && buf[idx + 2] == '-') { endTagPos = endTagPosition(buf, idx, 3000, false); ... |
String | toTextareaInput(String str) to Textarea Input if (str == null) return ""; str = str.replaceAll("&", "&"); str = str.replaceAll("<", "<"); str = str.replaceAll(">", ">"); return str; |