S
Simon Strandgaard
While extending my own regexp-engine with a split method,
I discovered something odd about Ruby's split.
irb(main):001:0> 'ab1ab'.split(/\D+/)
=> ["", "1"]
Its asymmetric, it has a special case for eliminating
the last empty string.. but apparently not the first empty string.
I would have expected above to be symmetric, and output:
=> ["1"]
I discovered something odd about Ruby's split.
irb(main):001:0> 'ab1ab'.split(/\D+/)
=> ["", "1"]
Its asymmetric, it has a special case for eliminating
the last empty string.. but apparently not the first empty string.
I would have expected above to be symmetric, and output:
=> ["1"]