
ext.test4j.apache.commons.lang.StringEscapeUtils Maven / Gradle / Ivy
package ext.test4j.apache.commons.lang;
import ext.test4j.apache.commons.lang.Entities;
public class StringEscapeUtils {
/**
*
* Escapes the characters in a String
using XML entities.
*
*
*
* For example: "bread" & "butter" =>
* "bread" & "butter".
*
*
*
* Supports only the five basic XML entities (gt, lt, quot, amp, apos). Does
* not support DTDs or external entities.
*
*
*
* Note that unicode characters greater than 0x7f are currently escaped to
* their numerical \\u equivalent. This may change in future releases.
*
*
* @param str
* the String
to escape, may be null
* @return a new escaped String
, null
if null
* string input
* @see #unescapeXml(java.lang.String)
*/
public static String escapeXml(String str) {
if (str == null) {
return null;
}
return Entities.XML.escape(str);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy