title: How to read from StorageFile until a character in found in Windows Store app?
body: <p>I have an app for Windows Store and what i am trying to do is read text from a file. I have two textFields. The descriptionTextField accepts new lines.</p>
  
  <pre><code>    // Read from file
      public async Task ReadFile()
      {
          try
          {
              // get the file
              StorageFile notesStorageFile = await localFolder.GetFileAsync("NotesData.txt");
              var readThis = await FileIO.ReadLinesAsync(notesStorageFile);
              foreach (var line in readThis)
              {
                  notesRepository.Add(new Note(line.Split(';')[0], line.Split(';')[1]));
              }
              Debug.WriteLine("File read successfully.");
          }
          catch (FileNotFoundException ex)
          {
              Debug.WriteLine("Error1: " + ex);
          }
      }
  </code></pre>
  
  <p>Now if <em>NotesData.txt</em> has:</p>
  
  <p><strong>Eggs;description eggs;</strong></p>
  
  <p>it works file.</p>
  
  <p>But if <em>NotesData.txt</em> has:</p>
  
  <p><strong>Groceries;buy 10 eggs</strong></p>
  
  <p><strong>buy 1 kg meat;</strong></p>
  
  <p>I get the index out of bound error. I just cant figure out how to fix the ReadFile() code. </p>
  
  <p>The exception appears when i am calling the method. The problem i believe is with the descriptionTextBox that can accept new lines.</p>
  
  <p>NotesData.txt</p>
  
  <p>Apples;description apples;         // works ok</p>
  
  <p>Pears; description line 1</p>
  
  <p>description line 2</p>
  
  <p>description line 3;                    // problem</p>
  
  <p>Pears; description line 1;         // works ok</p>