Can someone explain this behaviour:
"one,two,three".split(",").length == 3
"one,two".split(",").length == 2
"one".split(",").length == 1
"".split(",").length != 0 // eek!
Can someone explain this behaviour:
"one,two,three".split(",").length == 3
"one,two".split(",").length == 2
"one".split(",").length == 1
"".split(",").length != 0 // eek!
 
    
     
    
    From javadoc:
If the expression does not match any part of the input then the resulting array has just one element, namely this string.
split(regex) -> split(regex, 0) so take a look on split(String regex, int limit)
 
    
    This behavoiur is consistent:
"one".split(",") // {"one"}
"".split(",") // {""}
The empty String "" is a String like "one", so it behaves just like that (or any other String).
