正则表达式 - java获得一个String字符串中第一个数字的下标,并截取后面的6位和前面的地区
天蓬老师
天蓬老师 2017-04-18 10:45:47
0
5
1506
天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(5)
左手右手慢动作
String s = "杭州20170222ax";
Pattern p = Pattern.compile("([0-9].{5,5})");
Matcher m = p.matcher(s);
m.find();
System.out.println(m.group(1));
阿神

Traverse the string, str.charAt(i)>=48 && str.charAt(i)<=57 to determine the number, the first one that meets the requirements is the subscript

大家讲道理
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...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!