String abc = "a,b,c,d,,,";
String[] arr = abc.split(",");
System.out.println(arr.length);
Output is 4. But obviously my expectation is 7. Here is my solution:
String abc = "a,b,c,d,,,";
abc += "\n";
String[] arr = abc.split(",");
System.out.println(arr.length);
Why does it happen? Anyone could give my a better solution?