开始想到String.replaceFirst(regex, replacement)和String.replaceAll(regex, replacement);
但特殊字符没替换成功。
用法:StringUtils.replace("目标字符串","需要替换的内容","替换成的内容");
public static void main(String[] args) {
String t="asdf#{}sadf;kal#{}";
System.out.println(t.indexOf("#{}"));
String replace = StringUtils.replaceOnce(t,"#{}","<input>");
System.out.println(replace);
}
参考https://zhidao.baidu.com/question/1575809481137449380.html