-1

In objective-c, the fastest way to delete repeat object.

like

I have a array:

@[@"1",@"2",@"4",@"4",@"4",@"2"] .

Output the answer

@[@"1",@"2",@"4"];
Donald Duck
  • 8,409
  • 22
  • 75
  • 99
lexindd
  • 1
  • 1
  • Try this code . `NSOrderedSet *orderedSet = [NSOrderedSet orderedSetWithArray:yourArray]; NSArray *arrayWithoutDuplicates = [orderedSet array];` – Ketan Odedra Aug 04 '18 at 08:01

1 Answers1

1
NSArray<NSString *> *unique = [NSOrderedSet orderedSetWithArray: @[@"1",@"2",@"4",@"4",@"4",@"2"]].array;
cocavo
  • 163
  • 8