I have an NSSet
that contains four NSString
s. If I call -containsObject:
to see if the NSSet
contains a certain string, is it possible to delete the entry in the NSSet
that is equal to the string that I just checked?
If my question makes no sense, it may be because using a NSSet
may be the wrong way to approach this.
I have four NSStrings
and would like to put them in some sort of group (Set, Array, etc.). I then want to check if another NSString
matches any of the NSString
s in the group. If there is a match between the NSString
and a NSString
inside the group, I want to be able to delete the NSString
match inside the group. Is this possible to do?
Let's say your set is *mySet
and the object you want to remove is objectToRemove
. Then you can do this:
NSMutableSet *mutableSet = [NSMutableSet setWithSet:mySet];
[mutableSet removeObject:objectToRemove];
mySet = mutableSet;