日期:2014-05-20 浏览次数:20627 次
String str=""; for(String _s:s){ str+=_s+","; } str=str.replaceAll("([0-9]{2})(?=[0-9])", "$1,"); s=str.split(",");
------解决方案--------------------
循环递归就好:
public static void main(String[] args) { String[] string = {"12","345","6789","0"}; for(String s : string){ substring(s); } } public static void substring(String s){ String printString = null; if(s.length() > 2){ printString = s.substring(0, 2); System.out.println(printString); substring(s.substring(2)); }else{ System.out.println(s); } }