Following is my string variable :
String str = "Home(om), Home(gia)";
I want to replace the substring om present between () with tom.
I am able to find the index of () in which om is present, but the following will not work :
int i1 = str.indexOf("(");
int i2 = str.indexOf(")");
str = str.replace(str.substring(i1+1,i2),"tom");
I require the result as Home(tom), Home(gia).
How to do this?
str.