string.split method in ruby behaves funny to me

Posted by Steve on Stack Overflow See other posts from Stack Overflow or by Steve
Published on 2010-04-19T12:23:36Z Indexed on 2010/04/19 12:33 UTC
Read the original article Hit count: 215

Filed under:
|
|

txt = "1aaa5"

Then

txt.split("a") produces [1, "", "", 5] in ruby 1.9. Anyone can explain why? Particularly, why not [1, 5]? Thanks.

© Stack Overflow or respective owner

Related posts about ruby

Related posts about string