|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
ObjectStringEscapeUtils
public class StringEscapeUtils extends Object
Escapes and unescapes Strings for
Java, Java Script, HTML, XML, and SQL.
| Constructor and Description |
|---|
StringEscapeUtils()
StringEscapeUtils instances should NOT be constructed in
standard programming. |
| Modifier and Type | Method and Description |
|---|---|
static String |
escapeJava(String str)
Escapes the characters in a String using Java String rules. |
static void |
escapeJava(Writer out,
String str)
Escapes the characters in a String using Java String rules to
a Writer. |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StringEscapeUtils()
StringEscapeUtils instances should NOT be constructed in
standard programming.
Instead, the class should be used as:
StringEscapeUtils.escapeJava("foo");
This constructor is public to permit tools that require a JavaBean instance to operate.
| Method Detail |
|---|
public static String escapeJava(String str)
Escapes the characters in a String using Java String rules.
Deals correctly with quotes and control-chars (tab, backslash, cr, ff, etc.)
So a tab becomes the characters '\\' and
't'.
The only difference between Java strings and JavaScript strings is that in JavaScript, a single quote must be escaped.
Example:
input string: He didn't say, "Stop!" output string: He didn't say, \"Stop!\"
str - String to escape values in, may be nullnull if null string input
public static void escapeJava(Writer out,
String str)
throws IOException
Escapes the characters in a String using Java String rules to
a Writer.
A null string input has no effect.
out - Writer to write escaped string intostr - String to escape values in, may be nullIllegalArgumentException - if the Writer is nullIOException - if error occurs on underlying WriterescapeJava(java.lang.String)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||