java字符串的替换
String m = "asdads %qwe231ew% skfdj %ewiwl%";
String s = "替换";
System.out.println(m);
想要他输出结果是
asdads 替换 skfdj 替换
意思就是吧两个%....% 中的文字替换掉
求大神指点
------解决方案--------------------public static void main(String[] args)throws Exception {
String m = "asdads %qwe231ew% skfdj %ewiwl%";
String s = "替换";
m = m.replaceAll("%.*?%", s);
System.out.println(m);
}