'배열 중복값 제거'에 해당되는 글 1건

  1. 2015.01.28 [IOS / Object-C] - NSMutableArray 중복값 제거

[IOS / Object-C] - NSMutableArray 중복값 제거

IOS ( Object-C ) 2015. 1. 28. 19:04
반응형

NSMutableArray *_userIds = [NSMutableArray new];


for( NSInteger i = 0; i < 3; i++ ) {

  [_userIds insertObject:@"aaaaaaaaaa" atIndex:i];

}


NSOrderedSet *userSet = [[NSOrderedSet alloc] initWithArray:_userIds];

_userIds = [[NSMutableArray alloc] initWithArray:[userSet array]];

반응형
: