小编vik*_*mar的帖子

如何从多个数组中提取唯一对象

编辑:
我有两个不同的数组与一些重复的字符串,我想创建一个只有唯一字符串的新数组.

例如,取这两个数组:

NSArray *array1 = [[NSArray alloc] initWithObjects:@"a",@"b",@"c",nil]; 
NSArray *array2 = [[NSArray alloc] initWithObjects:@"a",@"d",@"c",nil];

// Result should be an array with objects "b", and "d" 
// since they are the only two that are not repeated in the other array.
Run Code Online (Sandbox Code Playgroud)

objective-c nsarray ios5

4
推荐指数
1
解决办法
2051
查看次数

标签 统计

ios5 ×1

nsarray ×1

objective-c ×1