2012年(272)
分类: Python/Ruby
2012-06-26 11:24:12
import org.apache.commons.lang.StringEscapeUtils;
public class StringUtilsEscapeExampleV1 {
public static void main(String args[]) {
String unescapedJava = "Are you for real?";
System.err.println(
StringEscapeUtils.escapeJava(unescapedJava));
String unescapedJavaScript = "What's in a name?";
System.err.println(
StringEscapeUtils.escapeJavaScript(unescapedJavaScript));
String unescapedSql = "Mc'Williams";
System.err.println(
StringEscapeUtils.escapeSql(unescapedSql));
String unescapedXML = "";
System.err.println(
StringEscapeUtils.escapeXml(unescapedXML));
String unescapedHTML = "";
System.err.println(
StringEscapeUtils.escapeHtml(unescapedHTML));
}
}