我想将html标签替换为另一个标签:
for (int i = 1; i <= htmlarray.size(); i++)
{
Content = Content.replaceAll("<Sup><FONT size=\"+1\">" + i+ "<","<Sup><FONT size=\"+2\"><a style=\"color: #664b38\"href=\"http:/"+ i + "\">" + i + "</a><");
}
答案 0 :(得分:1)
我得到了答案,现在是:
public String replace(CharSequence target, CharSequence replacement) {
return Pattern.compile(target.toString(), Pattern.LITERAL).matcher(target).replaceAll(Matcher.quoteReplacement(replacement.toString()));
}
这个功能对我有用。并且还使用replace()
函数。
for (int i = 1; i <= htmlarray.size(); i++)
{
Content = Content.replace("<Sup><FONT size=\"+1\">" + i+ "<","<Sup><FONT size=\"+2\"><a style=\"color: #664b38\"href=\"http:/"+ i + "\">" + i + "</a><");
}