欢迎选择我的课程,让我们一起见证您的进步~~
String s = "杭州20170222ax"; Pattern p = Pattern.compile("([0-9].{5,5})"); Matcher m = p.matcher(s); m.find(); System.out.println(m.group(1));
遍历字符串,str.charAt(i)>=48 && str.charAt(i)<=57判断数字,第一个符合要求的,就是下标
System.out.println( new Scanner("宁波20170222呵呵22").useDelimiter("\\D+").nextInt());
String s = "杭州20170222ax"; char[] chars = s.toCharArray(); for (int i = 0; i < chars.length; i++) { if (Character.isDigit(chars[i])) { System.out.println(s.substring(i, i + 6)); break; } }
http://www.cnblogs.com/androi...
遍历字符串,str.charAt(i)>=48 && str.charAt(i)<=57判断数字,第一个符合要求的,就是下标
http://www.cnblogs.com/androi...