/*
Escaped HTML >>> <p>MyName<p>
UnEscaped HTML >>> MyName
*/
import org.apache.commons.lang.StringEscapeUtils;
public class StringEscapeUtilsTrial {
public static void main(String[] args) {
String strHTMLInput = "
MyName
";
String strEscapeHTML = StringEscapeUtils.escapeHtml(strHTMLInput);
String strUnEscapeHTML = StringEscapeUtils.unescapeHtml(strEscapeHTML);
System.out.println("Escaped HTML >>> " + strEscapeHTML);
System.out.println("UnEscaped HTML >>> " + strUnEscapeHTML);
}
}
Apache-Common-Lang.zip( 248 k)