import java.util.regex.Matcher; import java.util.regex.Pattern; public class Test05 { public static void main(String[] args) { // TODO Auto-generated method stub String s = "第12章第3节"; Pattern p = Pattern.compile("\\d{1,}"); Matcher m = p.matcher(s); while(m.find()) { System.out.println(m.group()); } } }
将一个字符串中的数字提取出来
猜你喜欢
转载自blog.csdn.net/weixin_39788493/article/details/80737148
今日推荐
周排行