java中遇到空时 分割错误

说明:
String str = "a,b,c,,";
String[] ary = str.split(",");
//预期大于3,结果是3
System.out.println(ary.length);
解决办法:

说明:
String str = "a,b,c,,";
String[] ary = str.split(",",10000);
//预期大于3,结果是3
System.out.println(ary.length);

posted @ 2017-11-14 14:29  谢应东  阅读(260)  评论(0编辑  收藏  举报