String s1="2013-12-11 01"; String s2="2018-11-13 02"; String [] str1=s1.split("\\W"); String [] str2=s2.split("\\W"); System.out.println(str1.length+" "+str2.length); for(int i=0;i<4;i++) System.out.print(str1[i]+" "); System.out.println(" "); for(int i=0;i<4;i++) System.out.print(str2[i]+" ");
输出:
4 4 2013 12 11 01 2018 11 13 02
原文链接:https://www.f2er.com/regex/360393.html