|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsrc2xml.StringUtils.MultipleReplacer
public static class StringUtils.MultipleReplacer
A class that performs multiple replacement in a given String
Constructor Summary | |
---|---|
StringUtils.MultipleReplacer()
|
|
StringUtils.MultipleReplacer(java.lang.String s_pairs)
Class constructor |
Method Summary | |
---|---|
void |
addPair(java.lang.String old_s,
java.lang.String new_s)
Add a replacement pair (old string, new string) Be sure to not add multiple times the same String to replace |
void |
addPairs(java.lang.String s_pairs)
Retrieve replacement pairs from a String. |
java.lang.String |
doReplace(java.lang.String s)
Apply the collected replacement pairs |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StringUtils.MultipleReplacer(java.lang.String s_pairs)
s_pairs
- Initialize replacing pairspublic StringUtils.MultipleReplacer()
Method Detail |
---|
public void addPairs(java.lang.String s_pairs) throws java.lang.Exception
s_pairs
- The input String.
It must have the format: "(old1,new1) (old2,new2) (old3,new3) ..."
java.lang.Exception
- If the input String is invalidpublic void addPair(java.lang.String old_s, java.lang.String new_s)
old_s
- The occurrences to be replacednew_s
- The replacing Stringpublic java.lang.String doReplace(java.lang.String s) throws java.lang.Exception
s
- The input String to process
java.lang.Exception
- If something goes wrong
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |