hello i make a program that can highlight strings into a webview(android) and i stuck at replacing string with colored one, with this piece of code
String[] arr = "LION SAVANA".split(" ");//i split textview string to have words (here we suppose that user entered : "lion savana"
String finalText = "the lion is a species of mamifer living into the savana"
for (String ss : arr) {
if (ss.length() > 2) {
ss = ss.replace("*","");
finalText = finalText.replaceAll("(?i)" + ss, "<b style = \"color:#2575ff\";>" + ss + "</b>");//finally here i replace all lion or savana occurrences by blue ones -> but i not keeps case :(
}
}
after this loop the text will be "the LION is a species of mamifer living into the SAVANA" ,colored in blue like expected but with uppercase as i don't expect