title: Best way for read and write a text file
body: <p>I am using the latest version of Lazarus IDE and I have a <code>Memo1</code> on my TForm1. I have to load a text file in <code>Memo1</code> and then edit every line of the Memo (I use <code>Memo1.Lines.Strings[i] := ...</code>). At the end I must save the edited memo at a particular path.</p>
  
  <p><strong>Question</strong>: I am looking for the faster way between:</p>
  
  <ol>
  <li>Load the whole text inside the memo, edit its content and save into a new file (load all -> edit all -> write all)</li>
  <li>Do a <code>while</code> loop (until the end of my <code>*.txt</code> file) that reads the file line by line, edit the content and save it in the new file. (load line -> edit -> write | load -> edit -> write | load line -> edit -> write | ...)</li>
  </ol>
  
  <p>I am pretty new with Delphi developing, and I have also read some pages about <code>TStringLists</code>. My text file is going to have a lot of lines (It could have 5000+ lines) and I don't want that my program loses performance.</p>
  
  <p>Any suggestion? Should I use <code>TStringList</code> or one of the two methods I listed before? </p>