Re: Searching in NSArray

2009-06-05 Thread Kyle Sluder
On Fri, Jun 5, 2009 at 8:56 AM, Pierce Freeman wrote: > This looks like an interesting lead, I'll look into it later. Not to discourage you from reading the documentation, but this is how you would use it: -(NSArray *)itemsInArray:(NSArray *)inArray containingSubstring:(NSString *)substring { r

Re: Searching in NSArray

2009-06-05 Thread KK
instead of [s isEqualToString:], you could use [s compare:] On Fri, Jun 5, 2009 at 11:53 AM, Pierce Freeman wrote: > Hi KK: > > I was aware of this method to do so, but can this be done if you needed to > search for, say, “Good” and wanted it to return Goodbye? > > Thanks for your help. > > > O

Re: Searching in NSArray

2009-06-05 Thread Pierce Freeman
Kyle: This looks like an interesting lead, I'll look into it later. On 6/5/09 8:52 AM, "Kyle Sluder" wrote: > Look at the predicate programming guide, documentation for > NSPredicate, and -[NSArray filteredArrayUsingPredicate:]. > > --Kyle Sluder

Re: Searching in NSArray

2009-06-05 Thread Pierce Freeman
Hi KK: I was aware of this method to do so, but can this be done if you needed to search for, say, ³Good² and wanted it to return Goodbye? Thanks for your help. On 6/5/09 8:50 AM, "KK" wrote: > I'm not sure if this is what you're looking for, but Objective-C 2.0 has this: > > NSArray *a = [N

Re: Searching in NSArray

2009-06-05 Thread Kyle Sluder
Look at the predicate programming guide, documentation for NSPredicate, and -[NSArray filteredArrayUsingPredicate:]. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the lis

Re: Searching in NSArray

2009-06-05 Thread Keary Suska
On Jun 5, 2009, at 9:36 AM, Pierce Freeman wrote: Hi Everyone: I am most likely overlooking this function, but I just can't seem to find it in the documentation. I am looking for some way to search an NSArray listing for one string that is part of multiple objects in the array. This sear

Re: Searching in NSArray

2009-06-05 Thread KK
I'm not sure if this is what you're looking for, but Objective-C 2.0 has this: NSArray *a = [NSArray arrayWithObjects:@"Hello",@"Goodbye",nil]; for (NSString *s in a) { if ([s isEqualToString:@"Goodbye"]) { NSLog(@"it is equal"); } } And you can have an additional int (or NSInteg

Searching in NSArray

2009-06-05 Thread Pierce Freeman
Hi Everyone: I am most likely overlooking this function, but I just can't seem to find it in the documentation. I am looking for some way to search an NSArray listing for one string that is part of multiple objects in the array. This search then returns the number of objects that contained that