Skip to content

Instantly share code, notes, and snippets.

@rf-
Created October 14, 2012 03:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rf-/3887104 to your computer and use it in GitHub Desktop.
Save rf-/3887104 to your computer and use it in GitHub Desktop.
str = "foobar"[2..-1]
p str # => "obar"
p str.rindex(/a/) # => 0
p "obar".rindex(/a/) # => 2
str = "foobar"[3..-1]
p str # => "bar"
p str.rindex(/a/) # => nil
p "bar".rindex(/a/) # => 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment