美文网首页
判断两个数组中是否有不同的元素

判断两个数组中是否有不同的元素

作者: 一个记事本 | 来源:发表于2017-06-16 11:42 被阅读44次

    NSArray *selectTure = [@"数组一" filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"SELF in %@", @"数组二"]];

    NSArray *unselectTure = [@"数组一" filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"NOT (SELF in %@)", selectTure]];

    if (unselectTure.count >= 1) {

    NSLog(@"两个数组中有不同的元素-> %@", unselectTure);

    }else{

    NSLog(@"两个数组中没有不同的元素-> %@", unselectTure);

    }

    相关文章

      网友评论

          本文标题:判断两个数组中是否有不同的元素

          本文链接:https://www.haomeiwen.com/subject/jwgpqxtx.html