List of utility methods to do HTML Encode
String | textToHtml(String text) text To Html if (text == null) { return ""; text = text.replaceAll("&", "&"); text = text.replaceAll(">", ">"); text = text.replaceAll("<", "<"); text = text.replaceAll("\"", """); text = text.replaceAll("\\n", "<br/>"); ... |
String | textToHTML(String text) text To HTML if (text == null) { return ""; text = text.replace("\"", """).replace("\n", "<br>"); return text; |
String | textToHTML(String text) Converts a text string to HTML or XML entities. return textToHTML(text, false);
|
String | toHtml(String message) Surrounds with html tags. if (message != null) { return HTML_START + message + HTML_END; return null; |
String | toHTML(String msg) Turns the specified message into HTML code, for use with JLabels, tooltips and such, to achieve multiline text. msg = msg.replaceAll("<", "<"); msg = msg.replaceAll(">", ">"); msg = msg.replaceAll("\n", "<br/>"); return "<html>" + msg + "</html>"; |
String | toHTML(String org, boolean inputValue) to HTML StringBuffer result = new StringBuffer(org.length()); char[] chars = org.toCharArray(); for (int i = 0; i < chars.length; i++) { if (chars[i] == '\"') result.append("""); else if (chars[i] == '<') result.append("<"); else if (chars[i] == '>') ... |
String | toHtml(String p_str) to Html if (p_str == null || p_str.length() == 0) return ""; p_str = p_str.replaceAll("<", "<"); p_str = p_str.replaceAll(">", ">"); p_str = p_str.replaceAll("&", "&"); p_str = p_str.replaceAll("\"", """); return p_str; |
String | toHTML(String plainText) to HTML plainText = plainText.replace(System.getProperty("line.separator"), "<br>"); return "<html><head></head><body>" + plainText + "</body></html>"; |
String | toHTML(String rawText) Turns a string into HTML displayable text by escaping special characters ('<','&' etc...). String test; if (rawText.length() > 14) test = rawText.substring(0, 14).toLowerCase(); else test = rawText.toLowerCase(); if (test.startsWith("<html>") || test.startsWith("<!doctype html>")) { if (test.startsWith("<html>")) rawText = rawText.substring(6); ... |
String | toHTML(String s) Converts the given String into HTML, i.e., replacing some char entities with HTML entities. String result; if (s == null) return ""; result = s; result = result.replaceAll("&", "&"); result = result.replaceAll("<", "<"); result = result.replaceAll(">", ">"); result = result.replaceAll("@", "@"); ... |