String abc = "a,b,c,d,,,"; String[] arr = abc.split(","); System.out.println(arr.length);
The result 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 is this happening? Can anyone give me a better solution?
source share