【发布时间】:2012-05-15 09:51:19
【问题描述】:
我有两个 NSArray:
NSArray *wants = [NSArray arrayWithObjects:
@"apples",
@"oranges",
@"pineapple",
@"mango",
@"strawberries",
nil];
NSArray *needs = [NSArray arrayWithObjects:
@"apples",
@"pineapple",
@"strawberries",
nil];
我想XOR他们。像wants - needs 这样我剩下的就是
[NSArray arrayWithObjects:
@"oranges",
@"mango",
nil];
我通常会经历一些繁重的循环,但我相信还有更实用的方法。我应该怎么做?
【问题讨论】:
标签: objective-c cocoa cocoa-touch nsarray subtraction