How to quickly search an array of objects in Objective-C

Posted by randombits on Stack Overflow See other posts from Stack Overflow or by randombits
Published on 2010-05-04T21:30:34Z Indexed on 2010/05/04 21:38 UTC
Read the original article Hit count: 457

Filed under:
|
|

Is there a way in Objective-C to search an array of objects by the contained object's properties if the properties are of type string?

For instance, I have an NSArray of Person objects. Person has two properties, NSString *firstName and NSString *lastName.

What's the best way to search through the array to find everyone who matches 'Ken' anywhere in the firstName OR lastName properties?

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about cocoa