title: How can I compare case insensitive NSRange ?
body: <p>I wrote a method to search for people in address book, and I want the method to be able to find "john bigs" even if I call the method <code>[someAdressBook searchName:@"joh"];</code>.</p>
  
  <p>My method works for full names, but Im having issues in the partial names, this is my code:</p>
  
  <pre><code>-(NSMutableArray *) searchName:(NSString *) someName{
  
      NSRange range;
  
      NSMutableArray *results = [[NSMutableArray alloc] init];
  
      for (AddressCards *addressCard in book)
      {
          if (someName != nil &amp;&amp; [someName caseInsensitiveCompare:addressCard.name] == NSOrderedSame)
              [results addObject:addressCard.name];
  
          else {
              range = [addressCard.name rangeOfString:someName];
              if (range.location != NSNotFound)
              [results addObject:addressCard.name];
          }
      }
  
      NSLog(@"%@", results);
  
      return results;
  }
  </code></pre>
  
  <p>Please help me get this right.</p>