Class StringUtil.StringReplacer

java.lang.Object
org.cip4.jdflib.util.StringUtil.StringReplacer
Enclosing class:
StringUtil

public static class StringUtil.StringReplacer extends Object
class that provides additional functionality for replacing string
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    replaceString(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"
    void
    setReRead(boolean reRead)
    set the reread algorithm - if true (the default) the replaced string is checked again.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • StringReplacer

      public StringReplacer(String str)
      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

      public String replaceString(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"
      Parameters:
      toReplace - String to match and replace
      replaceBy - String to insert for toReplace, null if nothing should be inserted
      Returns:
      the String with replaced characters