Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Locate substring (index, rindex)

  • index
  • rindex
text = "The black cat climbed the green tree"

puts text.index("cat")
puts text.index("dog")

puts text.index("c")
puts text.rindex("c")