java String.split();

别的不说,单说其中一个问题,这个函数去切分空字符串时,得到的结果;

public static void main(String[] args) {
// String countType = "3,3";
String countType = "";
// String countType = null;
String[] a = countType.trim().split(",");
System.err.println(a.length);
if(null != a && a.length > 0){
System.err.println(a[0]);
}
}

这个打印的结果为:1

 

 posted on 2016-05-23 09:33  小Live  阅读(468)  评论(0编辑  收藏  举报