In my application I'm giving dictionary word suggestions and replacing the selected word with the suggested word using .replaceAll(). However that is replacing every sub string in the entire string
for example in this String,
String sentence = "od and not odds as a sample sam. but not odinary";
If I suggest the first word as odd .replaceAll() will replace every occurrence of od with odd hence affecting the fourth word to oddds and changing the sentence to
sentence.replaceAll("od", "odd");
//sentence String becomes
sentence ="odd and not oddds as a sample sam. but not oddinary"
Replacing the od to odd has affected all the other words which have the od characters in them.
Can any one help me with a better aproach?