org.linkedin.util-core/src/main/java/org/linkedin/util/text/TextUtils.java
public static String searchAndReplace(String s, String src, String dst)
  {
    if(s == null)
      return null;

    StringBuilder result = new StringBuilder();

    int i = 0;
    int len = s.length();
    int len2 = src.length();

    while(i < len)
    {
      int index = s.indexOf(src, i);
      if(index == -1)
      {
        if(i == 0)
          return s;

        result.append(s.substring(i));
        break;
      }

      result.append(s.substring(i, index));
      result.append(dst);

      i = index + len2;
    }

    return result.toString();
  }
public static String searchAndReplace(String s, String src, String dst)
  {
    if(s == null)
      return null;

    StringBuilder result = new StringBuilder();

    int i = 0;
    int len = s.length();
    int len2 = src.length();

    while(i < len)
    {
      int index = s.indexOf(src, i);
      if(index == -1)
      {
        if(i == 0)
          return s;

        result.append(s.substring(i));
        break;
      }

      result.append(s.substring(i, index));
      result.append(dst);

      i = index + len2;
    }

    return result.toString();
  }
Searches in the string '<code>s</code>' all occurences of the
substring '<code>src</code>' and replaces it with the string
'<code>dst</code>'.

@param s the string to search
@param src the substring to search for inside s
@param dst the replacing string
@return the string with the text replaced