"a,b,c,d,,,".split(",").length
returns 4, not 7 as you might (and I certainly did) expect. split
ignores all trailing empty Strings returned. That means:
",,,a,b,c,d".split(",").length
returns 7! To get what I would think of as the "least astonishing" behaviour, you need to do something quite astonishing:
"a,b,c,d,,,".split(",",-1).length
to get 7.