NSPredicate to test for NULL, and blank strings

前端 未结 4 1596
借酒劲吻你
借酒劲吻你 2020-12-07 18:15

I have an NSArray and need to filter out any strings that are null or rather, have \' \' (empty string). How do I do that? I have tried doing:

N         


        
4条回答
  •  死守一世寂寞
    2020-12-07 18:52

    I think this should work:

    NSPredicate *predicateName = [NSPredicate predicateWithFormat:@"name!=nil AND name!=''"]; 
    

提交回复
热议问题