Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- NSArray* set1 = [NSArray arrayWithObjects:@"one",@"two",@"three",nil];
- NSArray* set2 = [NSArray arrayWithObjects:@"two",@"three",@"four",nil];
- NSMutableArray* set3 = [NSMutableArray arrayWithCapacity:MIN(set1.count,set2.count)];
- for (NSString* element in set1) {
- if( [set2 containsObject:element] ) {
- [set3 addObject:element];
- }
- }
- // set3 => [ @"two", @"three" ]
Add Comment
Please, Sign In to add comment