public class Test2{ public static void main(String[] args) { String s = "211ahn678rh2kkk07312n3e12w4"; int begin = 0; outer:for(;begin<s.length();){ if(!(s.charAt(begin)>=48 && s.charAt(begin)<=57)){ begin++; continue; } int end = begin; for(;end<s.length();){ if(!(s.charAt(end)>=48 && s.charAt(end)<=57)){ System.out.println(s.substring(begin,end)); begin = end; break; }else{ end++; if(end == s.length()){ System.out.println(s.substring(begin)); break outer; }else{ continue; } } } } } }
转载于:https://www.cnblogs.com/iamconan/p/7383611.html
转载请注明原文地址: https://mac.8miu.com/read-3665.html