java中字符串Split问题
由于项目中有类似判断,写了一个小测试程序
public static void main(){
String aaa = "";
String bbb = ",";
String[] arra = aaa.split(",");
String[] arrb = bbb.split(",");
System.out.println(arra.length);
System.out.println(arrb.length);
}
得到的结果是
1
0
第二个结果怎么是0了?
public static void main(){
String aaa = "";
String bbb = ",";
String[] arra = aaa.split(",");
String[] arrb = bbb.split(",");
System.out.println(arra.length);
System.out.println(arrb.length);
}
得到的结果是
1
0
第二个结果怎么是0了?
posted on 2006-06-14 16:33 gigikouyi 阅读(1349) 评论(0) 编辑 收藏 举报