Did you know that:
"a,b,c,d,,,".split(",").length
returns 4???
But this:
",,,a,b,c,d".split(",").length
returns 7???
You can fix it by changing the limit of split to -1
"a,b,c,d,,,".split(",",-1).length
returns 7
Strange, but you can check my code on GitHub/Gist: https://gist.github.com/mrparity/9082508