我有一个电话号码数组,我需要检查一个特定的(给定的)电话号码是否包含在该数组中。那么我如何使用 NSPredicate 来做到这一点。(注意,目前我正在使用数组包含对象方法。在我的问题中,我需要一个使用谓词的解决方案)。所以如果有人知道这个请帮助我
NSString *p = allUsers.phoneNumber;
NSString *p1 = [p stringByReplacingOccurrencesOfString:@"-" withString:@""];
NSString *p2 = [p1 stringByReplacingOccurrencesOfString:@"(" withString:@""];
NSString *p3 = [p2 stringByReplacingOccurrencesOfString:@")" withString:@""];
NSString *p4 = [p3 stringByReplacingOccurrencesOfString:@" " withString:@""];
NSString *p5 = [p4 stringByReplacingOccurrencesOfString:@"+" withString:@""];
NSString *p6 = [p5 stringByReplacingOccurrencesOfString:@"*" withString:@""];
NSString *p7 = [p6 stringByReplacingOccurrencesOfString:@"#" withString:@""];
if ([arrayAllPhoneNumbers containsObject:p7])
{
allUsers.isPhoneUser = YES;
}