Deprecated
As of 3.6, use Apache Commons Text StringEscapeUtils instead.
Strings for
Java, Java Script, HTML and XML.
#ThreadSafe#
| Modifier and Type | Class and Description |
|---|---|
| private static class | StringEscapeUtils.
References Deprecated
CharSequenceTranslator is deprecated or references (maybe indirectly) at least one deprecated element.
|
| private static class | StringEscapeUtils.
References Deprecated
CharSequenceTranslator is deprecated or references (maybe indirectly) at least one deprecated element.
|
| Modifier and Type | Field and Description |
|---|---|
| public static final CharSequenceTranslator | ESCAPE_CSV
References Deprecated
Translator object for escaping individual Comma Separated Values.
CharSequenceTranslator is deprecated or references (maybe indirectly) at least one deprecated element.
|
| public static final CharSequenceTranslator | ESCAPE_ECMASCRIPT
References Deprecated
Translator object for escaping EcmaScript/JavaScript.
CharSequenceTranslator is deprecated or references (maybe indirectly) at least one deprecated element.
|
| public static final CharSequenceTranslator | ESCAPE_HTML3
References Deprecated
Translator object for escaping HTML version 3.0.
CharSequenceTranslator is deprecated or references (maybe indirectly) at least one deprecated element.
|
| public static final CharSequenceTranslator | ESCAPE_HTML4
References Deprecated
Translator object for escaping HTML version 4.0.
CharSequenceTranslator is deprecated or references (maybe indirectly) at least one deprecated element.
|
| public static final CharSequenceTranslator | ESCAPE_JAVA
References Deprecated
Translator object for escaping Java.
CharSequenceTranslator is deprecated or references (maybe indirectly) at least one deprecated element.
|
| public static final CharSequenceTranslator | ESCAPE_JSON
References Deprecated
Translator object for escaping Json.
CharSequenceTranslator is deprecated or references (maybe indirectly) at least one deprecated element.
|
| public static final CharSequenceTranslator | ESCAPE_XML
Deprecated
Use Translator object for escaping XML.
ESCAPE_XML10 or ESCAPE_XML11 instead.
|
| public static final CharSequenceTranslator | ESCAPE_XML10
References Deprecated
Translator object for escaping XML 1.0.
CharSequenceTranslator is deprecated or references (maybe indirectly) at least one deprecated element.
|
| public static final CharSequenceTranslator | ESCAPE_XML11
References Deprecated
Translator object for escaping XML 1.1.
CharSequenceTranslator is deprecated or references (maybe indirectly) at least one deprecated element.
|
| public static final CharSequenceTranslator | UNESCAPE_CSV
References Deprecated
Translator object for unescaping escaped Comma Separated Value entries.
CharSequenceTranslator is deprecated or references (maybe indirectly) at least one deprecated element.
|
| public static final CharSequenceTranslator | UNESCAPE_ECMASCRIPT
References Deprecated
Translator object for unescaping escaped EcmaScript.
CharSequenceTranslator is deprecated or references (maybe indirectly) at least one deprecated element.
|
| public static final CharSequenceTranslator | UNESCAPE_HTML3
References Deprecated
Translator object for unescaping escaped HTML 3.0.
CharSequenceTranslator is deprecated or references (maybe indirectly) at least one deprecated element.
|
| public static final CharSequenceTranslator | UNESCAPE_HTML4
References Deprecated
Translator object for unescaping escaped HTML 4.0.
CharSequenceTranslator is deprecated or references (maybe indirectly) at least one deprecated element.
|
| public static final CharSequenceTranslator | UNESCAPE_JAVA
References Deprecated
Translator object for unescaping escaped Java.
CharSequenceTranslator is deprecated or references (maybe indirectly) at least one deprecated element.
|
| public static final CharSequenceTranslator | UNESCAPE_JSON
References Deprecated
Translator object for unescaping escaped Json.
CharSequenceTranslator is deprecated or references (maybe indirectly) at least one deprecated element.
|
| public static final CharSequenceTranslator | UNESCAPE_XML
References Deprecated
Translator object for unescaping escaped XML.
CharSequenceTranslator is deprecated or references (maybe indirectly) at least one deprecated element.
|
| Access | Constructor and Description |
|---|---|
| public | StringEscapeUtils()
Deprecated
TODO Make private in 4.0.
|
| Modifier and Type | Method and Description |
|---|---|
| public static final String | |
| public static final String | Returns: String with escaped values,null if null string inputString to escape values in, may be null input)Escapes the characters in a |
| public static final String | escapeHtml3(final String
the input)String to escape, may be nullEscapes the characters in a |
| public static final String | escapeHtml4(final String
the input)String to escape, may be nullEscapes the characters in a |
| public static final String | Returns: String with escaped values,null if null string inputString to escape values in, may be null input)Escapes the characters in a |
| public static final String | Returns: String with escaped values,null if null string inputString to escape values in, may be null input)Escapes the characters in a |
| public static final String | escapeXml(final String
the input)String to escape, may be null
Deprecated
Use
escapeXml10(java. or escapeXml11(java. instead.
Escapes the characters in a |
| public static String | escapeXml10(final String
the input)String to escape, may be nullEscapes the characters in a |
| public static String | escapeXml11(final String
the input)String to escape, may be nullEscapes the characters in a |
| public static final String | Returns: the input String, with enclosing double quotes removed and embedded double quotes unescaped,null if null string inputthe input CSV column String, may be null input)Returns a |
| public static final String | unescapeEcmaScript(final String
the input)String to unescape, may be nullUnescapes any EcmaScript literals found in the |
| public static final String | unescapeHtml3(final String
the input)String to unescape, may be nullUnescapes a string containing entity escapes to a string containing the actual Unicode characters corresponding to the escapes. |
| public static final String | unescapeHtml4(final String
the input)String to unescape, may be nullUnescapes a string containing entity escapes to a string containing the actual Unicode characters corresponding to the escapes. |
| public static final String | unescapeJava(final String
the input)String to unescape, may be nullUnescapes any Java literals found in the |
| public static final String | unescapeJson(final String
the input)String to unescape, may be nullUnescapes any Json literals found in the |
| public static final String | unescapeXml(final String
the input)String to unescape, may be nullUnescapes a string containing XML entity escapes to a string containing the actual Unicode characters corresponding to the escapes. |
| ESCAPE_CSV | back to summary |
|---|---|
| public static final CharSequenceTranslator ESCAPE_CSV
References Deprecated
See corresponding docs for further information. Translator object for escaping individual Comma Separated Values.
While
| |
| ESCAPE_ECMASCRIPT | back to summary |
|---|---|
| public static final CharSequenceTranslator ESCAPE_ECMASCRIPT
References Deprecated
See corresponding docs for further information. Translator object for escaping EcmaScript/JavaScript.
While
| |
| ESCAPE_HTML3 | back to summary |
|---|---|
| public static final CharSequenceTranslator ESCAPE_HTML3
References Deprecated
See corresponding docs for further information. Translator object for escaping HTML version 3.0.
While
| |
| ESCAPE_HTML4 | back to summary |
|---|---|
| public static final CharSequenceTranslator ESCAPE_HTML4
References Deprecated
See corresponding docs for further information. Translator object for escaping HTML version 4.0.
While
| |
| ESCAPE_JAVA | back to summary |
|---|---|
| public static final CharSequenceTranslator ESCAPE_JAVA
References Deprecated
See corresponding docs for further information. Translator object for escaping Java.
While
| |
| ESCAPE_JSON | back to summary |
|---|---|
| public static final CharSequenceTranslator ESCAPE_JSON
References Deprecated
See corresponding docs for further information. Translator object for escaping Json.
While
| |
| ESCAPE_XML | back to summary |
|---|---|
| public static final CharSequenceTranslator ESCAPE_XML
Deprecated Use Translator object for escaping XML.
While
| |
| ESCAPE_XML10 | back to summary |
|---|---|
| public static final CharSequenceTranslator ESCAPE_XML10
References Deprecated
See corresponding docs for further information. Translator object for escaping XML 1.0.
While
| |
| ESCAPE_XML11 | back to summary |
|---|---|
| public static final CharSequenceTranslator ESCAPE_XML11
References Deprecated
See corresponding docs for further information. Translator object for escaping XML 1.1.
While
| |
| UNESCAPE_CSV | back to summary |
|---|---|
| public static final CharSequenceTranslator UNESCAPE_CSV
References Deprecated
See corresponding docs for further information. Translator object for unescaping escaped Comma Separated Value entries.
While
| |
| UNESCAPE_ECMASCRIPT | back to summary |
|---|---|
| public static final CharSequenceTranslator UNESCAPE_ECMASCRIPT
References Deprecated
See corresponding docs for further information. Translator object for unescaping escaped EcmaScript.
While
| |
| UNESCAPE_HTML3 | back to summary |
|---|---|
| public static final CharSequenceTranslator UNESCAPE_HTML3
References Deprecated
See corresponding docs for further information. Translator object for unescaping escaped HTML 3.0.
While
| |
| UNESCAPE_HTML4 | back to summary |
|---|---|
| public static final CharSequenceTranslator UNESCAPE_HTML4
References Deprecated
See corresponding docs for further information. Translator object for unescaping escaped HTML 4.0.
While
| |
| UNESCAPE_JAVA | back to summary |
|---|---|
| public static final CharSequenceTranslator UNESCAPE_JAVA
References Deprecated
See corresponding docs for further information. Translator object for unescaping escaped Java.
While
| |
| UNESCAPE_JSON | back to summary |
|---|---|
| public static final CharSequenceTranslator UNESCAPE_JSON
References Deprecated
See corresponding docs for further information. Translator object for unescaping escaped Json.
While
| |
| UNESCAPE_XML | back to summary |
|---|---|
| public static final CharSequenceTranslator UNESCAPE_XML
References Deprecated
See corresponding docs for further information. Translator object for unescaping escaped XML.
While
| |
| StringEscapeUtils | back to summary |
|---|---|
| public StringEscapeUtils()
Deprecated TODO Make private in 4.0.
Instead, the class should be used as: StringEscapeUtils.escapeJava("foo");
This constructor is public to permit tools that require a JavaBean instance to operate.
| |
| escapeCsv | back to summary |
|---|---|
| public static final String escapeCsv(final String input) Returns a If the value contains a comma, newline or double quote, then the String value is returned enclosed in double quotes. Any double quote characters in the value are escaped with another double quote. If the value does not contain a comma, newline or double quote, then the String value is returned unchanged. see Wikipedia and RFC 4180. | |
| escapeEcmaScript | back to summary |
|---|---|
| public static final String escapeEcmaScript(final String input) Escapes the characters in a Escapes any values it finds into their EcmaScript String form. Deals correctly with quotes and control-chars (tab, backslash, cr, ff, etc.) So a tab becomes the characters The only difference between Java strings and EcmaScript strings is that in EcmaScript, a single quote and forward-slash (/) are escaped. Note that EcmaScript is best known by the JavaScript and ActionScript dialects. Example: input string: He didn't say, "Stop!" output string: He didn\'t say, \"Stop!\" | |
| escapeHtml3 | back to summary |
|---|---|
| public static final String escapeHtml3(final String input) Escapes the characters in a Supports only the HTML 3.0 entities. | |
| escapeHtml4 | back to summary |
|---|---|
| public static final String escapeHtml4(final String input) Escapes the characters in a For example:
Supports all known HTML 4.0 entities, including funky accents. Note that the commonly used apostrophe escape character (') is not a legal entity and so is not supported).
| |
| escapeJava | back to summary |
|---|---|
| public static final String escapeJava(final String input) Escapes the characters in a Deals correctly with quotes and control-chars (tab, backslash, cr, ff, etc.) So a tab becomes the characters The only difference between Java strings and JavaScript strings is that in JavaScript, a single quote and forward-slash (/) are escaped. Example: input string: He didn't say, "Stop!" output string: He didn't say, \"Stop!\" | |
| escapeJson | back to summary |
|---|---|
| public static final String escapeJson(final String input) Escapes the characters in a Escapes any values it finds into their Json String form. Deals correctly with quotes and control-chars (tab, backslash, cr, ff, etc.) So a tab becomes the characters The only difference between Java strings and Json strings is that in Json, forward-slash (/) is escaped. See https://www.ietf.org/rfc/rfc4627.txt for further details. Example: input string: He didn't say, "Stop!" output string: He didn't say, \"Stop!\" | |
| escapeXml | back to summary |
|---|---|
| public static final String escapeXml(final String input)
Deprecated Use Escapes the characters in a For example: 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 as of 3.0, no longer
escaped. If you still wish this functionality, you can achieve it
via the following:
| |
| escapeXml10 | back to summary |
|---|---|
| public static String escapeXml10(final String input) Escapes the characters in a For example:
converts to:
Note that XML 1.0 is a text-only format: it cannot represent control characters or unpaired Unicode surrogate code points, even after escaping. The
method
Though not strictly necessary,
The returned string can be inserted into a valid XML 1.0 or XML 1.1 document. If you want to allow more non-text characters in an XML 1.1 document, use
| |
| escapeXml11 | back to summary |
|---|---|
| public static String escapeXml11(final String input) Escapes the characters in a For example: XML 1.1 can represent certain control characters, but it cannot represent
the null byte or unpaired Unicode surrogate code points, even after escaping.
The returned string can be inserted into a valid XML 1.1 document. Do not use it for XML 1.0 documents.
| |
| unescapeCsv | back to summary |
|---|---|
| public static final String unescapeCsv(final String input) Returns a If the value is enclosed in double quotes, and contains a comma, newline or double quote, then quotes are removed. Any double quote escaped characters (a pair of double quotes) are unescaped to just one double quote. If the value is not enclosed in double quotes, or is and does not contain a comma, newline or double quote, then the String value is returned unchanged. see Wikipedia and RFC 4180. | |
| unescapeEcmaScript | back to summary |
|---|---|
| public static final String unescapeEcmaScript(final String input) Unescapes any EcmaScript literals found in the For example, it will turn a sequence of
| |
| unescapeHtml3 | back to summary |
|---|---|
| public static final String unescapeHtml3(final String input) Unescapes a string containing entity escapes to a string containing the actual Unicode characters corresponding to the escapes. Supports only HTML 3.0 entities. | |
| unescapeHtml4 | back to summary |
|---|---|
| public static final String unescapeHtml4(final String input) Unescapes a string containing entity escapes to a string containing the actual Unicode characters corresponding to the escapes. Supports HTML 4.0 entities. For example, the string If an entity is unrecognized, it is left alone, and inserted
verbatim into the result string. e.g. | |
| unescapeJava | back to summary |
|---|---|
| public static final String unescapeJava(final String input) Unescapes any Java literals found in the | |
| unescapeJson | back to summary |
|---|---|
| public static final String unescapeJson(final String input) Unescapes any Json literals found in the For example, it will turn a sequence of
| |
| unescapeXml | back to summary |
|---|---|
| public static final String unescapeXml(final String input) Unescapes a string containing XML entity escapes to a string containing the actual Unicode characters corresponding to the escapes. Supports only the five basic XML entities (gt, lt, quot, amp, apos). Does not support DTDs or external entities. Note that numerical \\u Unicode codes are unescaped to their respective Unicode characters. This may change in future releases.
| |
References Deprecated
CharSequenceTranslator is deprecated or references (maybe indirectly) at least one deprecated element.
See corresponding docs for further information.
| Modifier and Type | Field and Description |
|---|---|
| private static final char | |
| private static final char | |
| private static final String | |
| private static final char[] |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public int | translate(final CharSequence input, final int index, final Writer out)
Implements abstract org. Translate a set of code points, represented by an int index into a CharSequence, into another set of code points. |
| CSV_DELIMITER | back to summary |
|---|---|
| private static final char CSV_DELIMITER | |
| CSV_QUOTE | back to summary |
|---|---|
| private static final char CSV_QUOTE | |
| CSV_QUOTE_STR | back to summary |
|---|---|
| private static final String CSV_QUOTE_STR | |
| CSV_SEARCH_CHARS | back to summary |
|---|---|
| private static final char[] CSV_SEARCH_CHARS | |
| CsvEscaper | back to summary |
|---|---|
| private CsvEscaper() | |
| translate | back to summary |
|---|---|
| public int translate(final CharSequence input, final int index, final Writer out) throws IOException Implements abstract org. Doc from org. Translate a set of code points, represented by an int index into a CharSequence, into another set of code points. The number of code points consumed must be returned, and the only IOExceptions thrown must be from interacting with the Writer so that the top level API may reliably ignore StringWriter IOExceptions.
| |
References Deprecated
CharSequenceTranslator is deprecated or references (maybe indirectly) at least one deprecated element.
See corresponding docs for further information.
| Modifier and Type | Field and Description |
|---|---|
| private static final char | |
| private static final char | |
| private static final String | |
| private static final char[] |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public int | translate(final CharSequence input, final int index, final Writer out)
Implements abstract org. Translate a set of code points, represented by an int index into a CharSequence, into another set of code points. |
| CSV_DELIMITER | back to summary |
|---|---|
| private static final char CSV_DELIMITER | |
| CSV_QUOTE | back to summary |
|---|---|
| private static final char CSV_QUOTE | |
| CSV_QUOTE_STR | back to summary |
|---|---|
| private static final String CSV_QUOTE_STR | |
| CSV_SEARCH_CHARS | back to summary |
|---|---|
| private static final char[] CSV_SEARCH_CHARS | |
| CsvUnescaper | back to summary |
|---|---|
| private CsvUnescaper() | |
| translate | back to summary |
|---|---|
| public int translate(final CharSequence input, final int index, final Writer out) throws IOException Implements abstract org. Doc from org. Translate a set of code points, represented by an int index into a CharSequence, into another set of code points. The number of code points consumed must be returned, and the only IOExceptions thrown must be from interacting with the Writer so that the top level API may reliably ignore StringWriter IOExceptions.
| |