NSPredicate case-insensitive matching on to-many relationship

后端 未结 5 1555
攒了一身酷
攒了一身酷 2020-12-07 09:48

I am implementing a search field where the user can type in a string to filter the items displayed in a view. Each object being displayed has a keywords to-man

5条回答
  •  借酒劲吻你
    2020-12-07 10:35

    If you want both case insensitive and wildcard, use this:

    NSPredicate *predicate = [NSPredicate predicateWithFormat:[NSString stringWithFormat:@"(name like[c] '*%@*')",@"search"]];
    

提交回复
热议问题