I want to replace a part of a string with another string. For example, a string comes in, and it contains meat
, but I want it to change that meat
to vegetable
. I know I can do this with the following statement.
str = str.replaceAll("meat", "vegetable");
However, I need to have the exact capitalization. I'm looking for a way to do this no matter what letters are upper or lowercase in the example meat
.
My application is a filter for Minecraft. Either swears, or just customizing the menu. Like I'd like to replace every instance of the word minecraft
, no matter the capitalization, to say Best game Ever!!
.
I have modded it so that it can recognize and replace specific capitalizations, but that is very limiting.
I hope I have supplied enough info so that someone can help me with this.