In Ruby 1.9.3 (and probably earlier versions, not sure), I\'m trying to figure out why Ruby\'s String#split method is giving me certain results. The results I\'m getting se
The ruby 1.9 documentation says
If the limit parameter is omitted, trailing null fields are suppressed.
So if we take your example:
"abcabc".split("a") #=> ["bc", "bc"]
And we include a limit value:
"abcabc".split("a", -1) #=> ["ab", "ab", ""]
You get the expected behavior.