|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ibm.commons.util.TextUtil
public final class TextUtil
Text utilities.
Constructor Summary | |
---|---|
TextUtil()
|
Method Summary | |
---|---|
static java.lang.String |
fromJavaString(java.lang.String s)
Convert a Java source string to a regular string. |
static java.lang.String |
fromXMLString(java.lang.String s)
Converts a XML string with internal entities into a Java string. |
static java.lang.String |
indentString(java.lang.String s,
java.lang.String indent)
Add a string before each row of an existing string. |
static java.lang.String |
toJavaString(java.lang.String s,
boolean addQuotes)
Format a string to be a JavaSource string. |
static java.lang.String |
toXMLString(java.lang.String s)
Converts a Java string to an XML one, with internal entities into a Java string. |
static java.lang.String |
toXMLString(java.lang.String s,
boolean ascii)
Converts a Java string to an XML one, with internal entities into a Java string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TextUtil()
Method Detail |
---|
public static java.lang.String indentString(java.lang.String s, java.lang.String indent)
This function may be used by code generators in order to properly indent code. To be consistent with Reader's behavior, a line is considered to be terminated by any one of a line feed ('\n'), a carriage return ('\r) or a carriage return immediately followed by a linefeed. In each case, the end of line characters are preserved as they are.
public static java.lang.String fromJavaString(java.lang.String s)
This replace all the escape sequences by the actual characters.
public static java.lang.String toJavaString(java.lang.String s, boolean addQuotes)
This replace all the special characters by escape sequences.
public static java.lang.String fromXMLString(java.lang.String s)
The entities parsed are
&
'
>
<
"
s
- the XML string
public static java.lang.String toXMLString(java.lang.String s)
The entities parsed are
&
'
>
<
"
s
- the Java string
public static java.lang.String toXMLString(java.lang.String s, boolean ascii)
&
'
>
<
"
s
- the Java stringascii
- ensure that all the character are in the ascii range, else they will be replaced by an entity
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |