in this below String arrays i have this tags:
String[] tags = {
"<mft:A>",
"<mft:S>",
"<mft:R>",
"</mft:A>",
"</mft:S>",
"</mft:R>"
};
and i want to replace them with this html tags:
String[] replacementHtmlTags = {
"<font color=\"red\">",
"<font color=\"green\">",
"<font color=\"blue\">",
"</font>",
"</font>",
"</font>"
};
now after define targets and replacements my code doesn't work:
String rawParagraph = "11111 <mft:A>22222</mft:A> 33333 <mft:S> 44444 <mft:A> 555555 <mft:S> 66666 </mft:S></mft:A></mft:S><mft:R> 77777 </mft:R>"
for (int tag = 0; tag < tags.length; tag++) {
rawParagraph.replace(tags[tag], replacementHtmlTags[tag]);
}
replace()returns the new value. It doesn't (can't) update the current value.