|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.karaf.util.StringEscapeUtils
public class StringEscapeUtils
Util class to manipulate String, especially around escape/unescape.
Constructor Summary | |
---|---|
StringEscapeUtils()
|
Method Summary | |
---|---|
static java.lang.String |
escapeJava(java.lang.String str)
Escapes the characters in a String using Java String rules. |
static java.lang.String |
hex(char ch)
Returns an upper case hexadecimal String for the given
character. |
static java.lang.String |
unescapeJava(java.lang.String str)
Unescapes any Java literals found in the String to a
Writer . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StringEscapeUtils()
Method Detail |
---|
public static java.lang.String unescapeJava(java.lang.String str)
Unescapes any Java literals found in the String
to a
Writer
.
str
- the String
to unescape, may be null
java.lang.IllegalArgumentException
- if the Writer is null
public static java.lang.String escapeJava(java.lang.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 null
null
if null string inputpublic static java.lang.String hex(char ch)
Returns an upper case hexadecimal String
for the given
character.
ch
- The character to convert.
String
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |