Skip to content

Instantly share code, notes, and snippets.

@monkz
Created June 16, 2012 21:30
Show Gist options
  • Save monkz/2942545 to your computer and use it in GitHub Desktop.
Save monkz/2942545 to your computer and use it in GitHub Desktop.
inconsitency in ruby string split
hiho little/big inconsistency in ruby core:
$ irb1.9.1
irb(main):001:0> test1 = " " # double space
=> " "
irb(main):002:0> test1.split(" ",2) # single space
=> [""]
irb(main):003:0> test2 = "tt" # double t
=> "tt"
irb(main):004:0> test2.split("t",2) # single t
=> ["", "t"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment