这是场景。
String strText = "ABC abc Abc aBC abC aBc ABc AbC";
// Adding a HTML content to this
String searchText = "abc";
String strFormatted = strText.replaceAll(
"(?i)" + searchText,
"<font color='red'>" + searchText + "</font>");
这将返回一个字符串,其中所有单词都是小写的,当然也是红色的。我的要求是获取strFormatted
字符串,其大小写与原始字符串相同,但它应该具有字体标签。
是否有可能做到这一点 ?