|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.rice.cs.javalanglevels.CharConverter
public abstract class CharConverter
A class full of static methods for escaping/unescaping characters. It's abstract because it should not be instantiated.
Constructor Summary | |
---|---|
CharConverter()
|
Method Summary | |
---|---|
static String |
escapeChar(char c)
Escapes the given char to be suitable for writing out in a Java char or String literal. |
static void |
escapeChar(char c,
StringBuffer buf)
Escapes the given char to be suitable for writing out in a Java char or String literal. |
static String |
escapeString(String s)
Escapes the given String to be suitable for writing out as a Java String literal. |
static char |
unescapeChar(String in)
Unescapes the given string, escaped as it would be in Java source, to a single char. |
static String |
unescapeString(String in)
Unescapes the given string, escaped as it would be in Java source, to a String. |
static int |
unescapeString(String in,
int startPos,
StringBuffer out)
Unescapes one character in the given string, escaped as it would be in Java source, to a String. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CharConverter()
Method Detail |
---|
public static String escapeChar(char c)
c
- Character to escape
public static void escapeChar(char c, StringBuffer buf)
c
- Character to escapebuf
- StringBuffer where the result is written outpublic static String escapeString(String s)
s
- String to escape
public static char unescapeChar(String in)
in
- String containing (possibly) escaped character, without quotes
public static String unescapeString(String in)
in
- String containing (possibly) escaped characters, without quotes
public static int unescapeString(String in, int startPos, StringBuffer out)
in
- String containing (possibly) escaped charactersstartPos
- Starting position of the next character to unescapeout
- StringBuffer to write out the unescaped character to.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |