public String plusOut(String str, String word){
String bob = str.replaceAll(^word,"+");
return bob;
}
Sample Input and Output:
I want to replace everything in String(str) that's not String(word) with a +
plusOut("1234xy5678", "xy") == "++++xy++++"
plusOut("ghlnds4pl4qwqd4", "4") == "++++++4++4++++4"
^word<---how would I make the method replace everything except for word
I want to replace my String(str) with a "+" except the String(word). How would I go about doing this using replaceAll method.