Pattern p = Pattern.compile("\d{2,}");//这个2是指连续数字的最少个数
String u = "abc435345defsfsaf564565fsabad5467755fewfadfgea";
Matcher m = p.matcher(u);
int i = 0;
while (m.find()) {
System.out.println(m.group());
i++;
}
System.out.println(i);
Pattern p = Pattern.compile("\d{2,}");//这个2是指连续数字的最少个数
String u = "abc435345defsfsaf564565fsabad5467755fewfadfgea";
Matcher m = p.matcher(u);
int i = 0;
while (m.find()) {
System.out.println(m.group());
i++;
}
System.out.println(i);
本文标题:取一串数字中的数字串
本文链接:https://www.haomeiwen.com/subject/zxzsvttx.html
网友评论