title: NSString componentsSeparatedByString
body: <p>I have a string coming from server. I am identifying a particular substring and then breaking the main string at that substring.  </p>
  
  <pre><code>NSString *string = /* getting from server */;
  NSString *strAddress = /* Substring of string */;
  NSArray *arr = [string componentsSeparatedByString:strAddress];
  NSString *strBeforeAddress = [arr objectAtIndex:0];
  </code></pre>
  
  <p>This works perfectly fine when <code>strAddress</code> has something before it. But in some cases it completely gives a strange result. For example, when</p>
  
  <pre><code>string = @"cxzcvxcv\n14, Beaven Dam Road\nVail, CO81657";
  strAddress = @"14, Beaven Dam Road\nVail, CO81657";
  </code></pre>
  
  <p>I get only one object in <code>arr</code>, the complete string, which I think is wrong. It should give result as 2 objects: <code>cxzcvxcv</code> and <code>blank object</code>. However, when</p>
  
  <pre><code>string = @"14, Beaven Dam Road\nVail, CO81657";
  strAddress = @"14, Beaven Dam Road\nVail, CO81657";
  </code></pre>
  
  <p>the array <code>arr</code> in this case has 1 object, the complete string. Can someone please explain what is going on here?</p>