String seq = ","; String ss = ",,,,a"; String ss2 = "a,,,,"; String[]arr = ss.split(seq) ; String[]arr2 = ss2.split(seq); String[]arr3 = StringUtils.split(ss,seq); String[]arr4 = ss2.split(seq,10); System.out.println(arr.length);//5 System.out.println(arr2.length);//1 System.out.println(arr3.length);//1 System.out.println(arr4.length);//5
对比分析原因
可参考: