I'm working on a program that needs to be able to search a string of text for certain words and then replace them with something else. I believe the best way (I'm probably wrong though
) would be to compare the string to an ArrayList of words, and then replace the words with different ones. Does this sound like it would work? If it does how do I compare individual words inside the string to the words in the arrayList? Thanks.
I've got another quick question. When using the replace() method, how come I can't just do
Whenever I do that it just gives me the same string that was stored in object.text. But when I do
object.text = object.text.replace("abc", "def");
it works fine. Is that because the replace() method returns a string? Thanks.