NSString lookup in NSSet

Viewed 13262

How may I find a certain string (value) in an NSSet?
Must this be done using predicates? If so, how?

NSMutableSet *set = [[NSMutableSet alloc] init];
[set addObject:[[[NSString alloc] initWithFormat:@"String %d", 1] autorelease]];
[set addObject:[[[NSString alloc] initWithFormat:@"String %d", 2] autorelease]];
[set addObject:[[[NSString alloc] initWithFormat:@"String %d", 3] autorelease]];

Now I want to check if 'String 2' exists in the set.

4 Answers
Related