code: public static void replace(final StringBuffer sb, final String find, final String replacement) {
  		int pos = 0;
  		while(pos<sb.length()) {
  			pos = sb.indexOf(find, pos);
  			if(pos==-1) break;
  			sb.replace(pos, pos+find.length(), replacement);
  			pos += replacement.length();
  		}
  	}
docs: Replaces all occurrences of a String with a String.