title: How do I search an array using a partial string, and return the index?
body: <p>I want to search through an array using a partial string, and then get the index where that string is found. For example:</p>
  
  <pre><code>a = ["This is line 1", "We have line 2 here", "and finally line 3", "potato"]
  a.index("potato") # this returns 3
  a.index("We have") # this returns nil
  </code></pre>
  
  <p>Using <code>a.grep</code> will return the full string, and using <code>a.any?</code> will return a correct true/false statement, but neither returns the index where the match was found, or at least I can't figure out how to do it.</p>
  
  <p>I'm working on a piece of code that reads a file, looks for a specific header, and then returns the index of that header so it can use it as an offset for future searches. Without starting my search from a specific index, my other searches will get false positives.</p>