code: public static ReplacedString replaceString(String s, String find, String replace) {
          if (replace == null) replace = "-";
          int index = -1;
          int l = find.length();
          boolean replaced = false;
          do {
              index = s.indexOf(find, index);
              if (index >= 0) {
                  replaced = true;
                  s = s.substring(0, index) + replace + s.substring(index + l);
              }
          } while (index >= 0);
          return new ReplacedString(s, replaced);
      }
docs: Replace a string with another
  
  @param s       string to replace into
  @param find    string to be replaced
  @param replace new string
  @return the string with replacements