public static String replaceAll(
      final String inputLine, final String source, final String target) {
    int index = inputLine.indexOf(source);

    String ret = inputLine;

    while (index != -1) {
      ret = ret.substring(0, index) + target + ret.substring(index + source.length());
      index = ret.indexOf(source);
    }

    return ret;
  }
Replaces all occurrences of a substring inside a string.

@param inputLine The input string.
@param source The substring to be replaced.
@param target The replacement of the substring.
@return The input line with all occurrences of source replaced by target.
java/zylib/src/main/java/com/google/security/zynamics/zylib/strings/StringHelper.java