title: Delphi - Find text in large TMemo
body: <p>I have a TMemo which <strong>contains quite a lot of texts</strong>, 80M (about 400K lines).</p>
  
  <p>The TMemo is set with WordWrap = FALSE, there is <strong>no need</strong> to find texts that wrapped in 2 lines.</p>
  
  <p>I need a fast way to find a text, from the beginning, and also find next.</p>
  
  <p>So, I put a TEdit for putting the text to find and a TButton to find the text in the TMemo.</p>
  
  <p>I was thinking to use Pos(), checking line by line, but that will be slow.
  And I don't know how to determine the TMemo.Lines[index] for current cursor position.</p>
  
  <p>Anyone can come up with solution?</p>
  
  <p>Thanks</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I found a solution from here:
  <a href="https://stackoverflow.com/questions/4232709/search-thru-a-memo-in-delphi">Search thru a memo in Delphi?</a></p>
  
  <p>The SearchText() function works, fast, and very fast.
  Took couple of seconds to search unique string at the bottom end.</p>