String result = replaceSubString("Johan Känngård","Johan", "Nisse");
public static String replaceSubString(
String s,
String search,
String replace) {
int p = 0;
while (p < s.length() && (p = s.indexOf(search, p)) >= 0) {
s = s.substring(0, p) + replace +
s.substring(p + search.length(), s.length());
p += replace.length();
}
return s;
}