Here you can find the source of escapeHTML(String s)
public static String escapeHTML(String s)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { private static Map<Character, String> HTML_CHAR_ESCAPED_MAP = new HashMap<Character, String>(); public static String escapeHTML(String s) { StringBuilder buffer = new StringBuilder(s.length()); for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c != '\r') { final String escaped = HTML_CHAR_ESCAPED_MAP.get(c); buffer.append(escaped != null ? escaped : c); }/*from w w w. java 2 s .co m*/ } return buffer.toString(); } }