title: Splitting NSString into NSArray on component '\n'
body: <p>I'm trying to split a <code>NSString</code> into a <code>NSArray</code>, and it's proving difficult even though this is normally an easy task. I'm receiving data, from my Python server and forming a <code>NSString</code> on the iPhone client. I noticed sometimes when I receive multiple messages from my Python server I would <code>NSLog</code> a string like:</p>
  
  <pre><code>Project: textOne
  textTwo
  </code></pre>
  
  <p>After adding the string into a <code>NSArray</code> and calling <code>NSLog</code> on that array the string would show:</p>
  
  <pre><code>Project: (
      "textOne\ntextTwo\n"
  )
  </code></pre>
  
  <p>After playing with code:</p>
  
  <pre><code>[str componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]];
  
  [str componentsSeparatedByString:@"\n"];
  
  [str substringToIndex:[str length]-1];
  </code></pre>
  
  <p>I have managed to produce <code>NSArray</code>'s with content:</p>
  
  <pre><code>Project: (
      "textOne",
      textTwo
  )
  </code></pre>
  
  <p>And</p>
  
  <pre><code>Project: (
      "textOne",
      textTwo,
      ""
  )
  </code></pre>
  
  <p>I <strong>cannot</strong> produce a <code>NSArray</code> with content:</p>
  
  <pre><code>Project: (
          textOne,
          textTwo
      )
  </code></pre>
  
  <p>If anyone could help, I'd greatly appreciate it.</p>