标签:
1 NSMutableArray *array = [NSMutableArray arrayWithObjects:@"1",@"2",@"2",@"4",@"5",@"6",@"7",@"8",@"9",@"0", nil]; 2 3 NSMutableArray *new = [NSMutableArray array]; 4 for (int i = 0; i<[array count]; i++) { 5 6 if ([new containsObject:[array objectAtIndex:i]] == NO) { 7 [new addObject:[array objectAtIndex:i]]; 8 } 9 } 10 NSLog(@"%@",new);
NSMutableArray *array = [NSMutableArray arrayWithObjects:@"1",@"2",@"2",@"4",@"5",@"6",@"7",@"8",@"9",@"0", nil]; NSSet *set = [NSSet setWithArray:array]; NSLog(@"%@",[set allObjects]);
标签:
原文地址:http://www.cnblogs.com/suqiankun/p/4936931.html