code: public static String substitute(String source, String searchString, String replaceString) {
  
          if (source == null) {
              return null;
          }
  
          if (isEmpty(searchString)) {
              return source;
          }
  
          if (replaceString == null) {
              replaceString = "";
          }
          int len = source.length();
          int sl = searchString.length();
          int rl = replaceString.length();
          int length;
          if (sl == rl) {
              length = len;
          } else {
              int c = 0;
              int s = 0;
              int e;
              while ((e = source.indexOf(searchString, s)) != -1) {
                  c++;
                  s = e + sl;
              }
              if (c == 0) {
                  return source;
              }
              length = len - (c * (sl - rl));
          }
  
          int s = 0;
          int e = source.indexOf(searchString, s);
          if (e == -1) {
              return source;
          }
          StringBuffer sb = new StringBuffer(length);
          while (e != -1) {
              sb.append(source.substring(s, e));
              sb.append(replaceString);
              s = e + sl;
              e = source.indexOf(searchString, s);
          }
          e = len;
          sb.append(source.substring(s, e));
          return sb.toString();
      }
docs: Substitutes <code>searchString</code> in the given source String with <code>replaceString</code>.<p>
  
  This is a high-performance implementation which should be used as a replacement for
  <code>{@link String#replaceAll(java.lang.String, java.lang.String)}</code> in case no
  regular expression evaluation is required.<p>
  
  @param source the content which is scanned
  @param searchString the String which is searched in content
  @param replaceString the String which replaces <code>searchString</code>
  
  @return the substituted String