Class StringUtil.StringReplacer

  • Enclosing class:
    StringUtil

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

      Constructors 
      Constructor Description
      StringReplacer​(java.lang.String str)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String replaceString​(java.lang.String toReplace, java.lang.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 Detail

      • StringReplacer

        public StringReplacer​(java.lang.String str)
        Parameters:
        str -
    • Method Detail

      • 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 java.lang.String replaceString​(java.lang.String toReplace,
                                              java.lang.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