code: public static void replaceFirst(StringBuffer haystack, String needle, String newNeedle) {
  		int idx = haystack.indexOf(needle);
  		if (idx != -1) {
  			haystack.replace(idx, idx + needle.length(), newNeedle);
  		}
  	}
docs: replaces the first occurance of needle in haystack with newNeedle
  
  @param haystack  input string
  @param needle	string to replace
  @param newNeedle replacement