0

I have 2 NSArrays with a bunch of NSStrings. I want to do an array subtraction, so I get all the elements from Array1 that are only in Array1 and not also in Array2. These NSString objects are different objects, but with the same string values.

Is there an easy way to do this, or do I need a double loop? In python, for example I could use a set operation, but I'm not sure how to do it in Obj-C.

dougalg
  • 529
  • 4
  • 14

1 Answers1

2

NSMutableSet gives you much of set operations you get in python

ennuikiller
  • 46,381
  • 14
  • 112
  • 137
  • Thank you very much! I had looked at NSSet and assumed that if NSSet didn't have any subtraction functionality, neither would the mutable set, but of course, it makes sense when I think of it as a method on a set rather than a method which would return a new set. – dougalg Mar 31 '13 at 03:50