Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(name LIKE "a*")", toFind];
- [request setPredicate:predicate];
- NSArray *items = [context executeFetchRequest:request error:&error];
- NSString *toFind = @"a";
- NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(name LIKE "%@*")", toFind];
- [request setPredicate:predicate];
- NSArray *items = [context executeFetchRequest:request error:&error];
- NSString *toFind = @"apple";
- NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(name = %@)", toFind];
- [request setPredicate:predicate];
- NSArray *items = [context executeFetchRequest:request error:&error];
- NSString *variableWildcard = [NSString stringWithFormat:@"%@*", toFind];
- [NSPredicate predicateWithFormat:@"(name LIKE %@)", variableWildcard]; // variable
- [NSPredicate predicateWithFormat:@"(name LIKE "a*")", toFind]; // constant
- NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(name LIKE[cd] %@)", [toFind stringByAppendingString:@"*"]];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement