On Apr 24, 2010, at 5:50 AM, Filip van der Meeren wrote:
> I want to get the difference between 2 characterSets. For example:
>
> I have the following 2 characterSets...
> NSCharacterSet *aSet = [NSCharacterSet
> characterSetWithCharactersInString:@"a"];
> NSCharacterSet *lowerSet = [NSCharacterSet lowercaseLetterCharacterSet];
>
> The difference between these (aSet - lowerSet = remainder):
IIRC, this line right here gets you an empty character set, which will also
give you an empty set any time you make an intersection with anything:
> NSMutableCharacterSet *remainder = [[NSMutableCharacterSet alloc] init];
so this one will get the intersection between ('a') and the empty set, which
will be the empty set:
> [remainder formIntersectionWithCharacterSet:aSet];
and ditto for this one. Note that even if remainder started out non-empty, it
wouldn’t have more than (‘a') in it after the first intersection, and since 'a'
is a member of lowerSet, being a lowercase letter, intersecting with [lowerSet
invertedSet] is still going to get you an empty set:
> [remainder formIntersectionWithCharacterSet:[lowerSet invertedSet]];
What exactly are you trying to do?
Charles_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]