Package org.cip4.jdflib.util
Class StringUtil.StringReplacer
java.lang.Object
org.cip4.jdflib.util.StringUtil.StringReplacer
- Enclosing class:
- StringUtil
class that provides additional functionality for replacing string
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionreplaceString(String toReplace, String replaceBy) replace a string in a given String if the replacement string is contained by the string to replace, recursively replace until no ocurrences of the original remain thus replaceString("a000000", "00", "0") will return "a0" rather than "a000"voidsetReRead(boolean reRead) set the reread algorithm - if true (the default) the replaced string is checked again.
-
Constructor Details
-
StringReplacer
- Parameters:
str-
-
-
Method Details
-
setReRead
public void setReRead(boolean reRead) set the reread algorithm - if true (the default) the replaced string is checked again. If false the algorithm continues after the replacement- Parameters:
reRead-
-
replaceString
replace a string in a given String if the replacement string is contained by the string to replace, recursively replace until no ocurrences of the original remain thus replaceString("a000000", "00", "0") will return "a0" rather than "a000"- Parameters:
toReplace- String to match and replacereplaceBy- String to insert for toReplace, null if nothing should be inserted- Returns:
- the String with replaced characters
-