This is somehow a duplicate of this problem Ruby - replace the first occurrence of a substring with another string just in java.
Problem is:
I have a string: "ha bla ha ha"
Now I want to replace the first (and only the first) "ha" with "gurp":
"gurp bla ha ha"
string.replace("ha", "gurp") doesn't work, as it replaces all "ha"s.
String#replaceFirst? or if you don't want to use regex [StringUtils#replaceOnce(..)][1][1]:(commons.apache.org/proper/commons-lang/javadocs/api-2.6/org/…, java.lang.String, java.lang.String))