来自
Apache Commons Lang的
StringEscapeUtils:
import static org.apache.commons.lang.StringEscapeUtils.escapeHtml;// ...String source = "The less than sign (<) and ampersand (&) must be escaped before using them in HTML";String escaped = escapeHtml(source);
对于版本3:
import static org.apache.commons.lang3.StringEscapeUtils.escapeHtml4;// ...String escaped = escapeHtml4(source);



