본문 바로가기
iOS/Objective-C

NSMutableArray

by 패쓰킴 2022. 11. 2.
728x90

중복 제거

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]];

출처 : https://mrkn.tistory.com/337

728x90

'iOS > Objective-C' 카테고리의 다른 글

NSDictionary  (0) 2022.11.04
NSArray  (0) 2022.11.02
NSString  (0) 2022.10.27
UIButton  (0) 2022.09.28
NotificationCenter(Observer)  (0) 2022.06.10

댓글