62,620
社区成员
发帖
与我相关
我的任务
分享
public class sdfsd {
public static void main(String[] args) {
String a=" 33 444 5555";
String t= " int i = 12";
System.out.println(a.replaceAll("(\\d+)", "<b>$1</b>"));
System.out.println(t.replaceAll("(\\d+)", "<b>$1</b>"));
}
}
String str = "33 44 555";
String result = str.replaceAll("\\b\\d", "<br>");
result = result.replaceAll("\\d\\b", "</br>");
System.out.println(result);
这样不行啊,每次匹配都把一个数字给替换了,
还是split分隔开,在处理吧String str = "33 44 555";
String result = str.replaceAll("\\b\\d", "<br>");
result = result.replaceAll("\\d\\b", "</br>");
System.out.println(result);
这样不行啊,每次匹配都把一个数字给替换了,
还是split分隔开,在处理吧