List of utility methods to do HTML Encode
String | toHtmlString(String input) to Html String if ((input == null) || (input.trim().length() == 0)) { return input; StringBuffer result = new StringBuffer(); char tmp; char lstchar = ' '; for (int i = 0; i < input.length(); i++) { tmp = input.charAt(i); ... |
String | toHTMLString(String org) to HTML String 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 | toHtmlString(String s) to Html String String toReturn = null; if (s == null) { return null; if (s.contains("!DOCTYPE HTML")) { s = replace(s, "!DOCTYPE HTML", ""); return s; toReturn = s; if (toReturn.contains("<")) { if (toReturn.contains("</a>") || toReturn.contains("</A>")) { return toReturn; toReturn = replace(toReturn, "<B>", BOLD_START); toReturn = replace(toReturn, "<b>", BOLD_START); toReturn = replace(toReturn, "</B>", BOLD_END); toReturn = replace(toReturn, "</b>", BOLD_END); toReturn = replace(toReturn, "<BR>", NEW_LINE); toReturn = replace(toReturn, "<br>", NEW_LINE); toReturn = replace(toReturn, "<", "<"); toReturn = replace(toReturn, ">", ">"); toReturn = replace(toReturn, BOLD_START, "<B>"); toReturn = replace(toReturn, BOLD_END, "</B>"); toReturn = replace(toReturn, NEW_LINE, "<br>"); toReturn = replace(toReturn, "\r\n", "<br>"); toReturn = replace(toReturn, "\r", "<br>"); toReturn = replace(toReturn, "\n", "<br>"); toReturn = replace(toReturn, " ", " "); toReturn = replace(toReturn, "\t", " "); return toReturn; |
String | toHTMLString(String str) Converts the given unicode string to an html string where special characters are converted to xx; sequences (xxx is the unicode value of the character)
if (str == null) return null; StringBuffer sb = new StringBuffer(); int len = str.length(); for (int i = 0; i < len; i++) { char c = str.charAt(i); int code = c; if ((code >= 32 && code <= 126)) { ... |
String | toHtmlText(String s) Description of the Method s = replace(s, "<br>\r\n", "<br>"); s = replace(s, "\r\n", "<br>"); return s; |
String | toHtmlText(String text) to Html Text StringBuffer htmlText = null; for (int i = 0; i < text.length(); i++) { String rep; char ch = text.charAt(i); switch (ch) { case '<': rep = "<"; break; ... |
String | toHtmlTitle(final String title) to Html Title return "<title>" + title + "</title>"; |
String | toHtmlUrl(String url, String displayLabel) to Html Url return String.format("<a href='%s'>%s</a>", url, displayLabel); |
String | toHtmlValue(String s) Description of the Method if (s != null) { String htmlReady = s.trim(); htmlReady = replace(htmlReady, "&", "&"); htmlReady = replace(htmlReady, "\"", """); htmlReady = replace(htmlReady, "<", "<"); htmlReady = replace(htmlReady, ">", ">"); htmlReady = replace(htmlReady, "\r\n", "<br>"); htmlReady = replace(htmlReady, "\n\r", "<br>"); ... |
String | toHtmlVerticalString(final String source) to Html Vertical String if ((source == null) || (source.trim().length() == 0)) { return source; final String tmp = source.trim(); final int len = tmp.length(); final StringBuffer result = new StringBuffer(); for (int i = 0; i < (len - 1); i++) { result.append(tmp.charAt(i)).append("<br>"); ... |