4 iphone objective-c nsstring nspredicate
我有这个谓词,它运作得很好.
NSPredicate *filter = [NSPredicate predicateWithFormat:@"code contains[cd] %@", predicateFilter];
所以,如果predicateFilter是112,此找到所有code有112它.我希望它能找到所有与BEGIN相关的代码112.
编辑:
我有这个谓词,我怎样才能使它的代码介于以predicateFilterStart开头的代码和以PredicateFilterEnd开头的代码之间?
NSPredicate *filterPredicate = [NSPredicate predicateWithFormat:@"ANY code BETWEEN %@",
[NSArray arrayWithObjects:
[NSExpression expressionForConstantValue: [NSNumber numberWithFloat: [self.predicateFilterStart floatValue]]],
[NSExpression expressionForConstantValue: [NSNumber numberWithFloat: [self.predicateFilterEnd floatValue]]],
nil]];
Run Code Online (Sandbox Code Playgroud)
NSPredicate *filter = [NSPredicate predicateWithFormat:@"code beginswith[cd] %@", predicateFilter];
Run Code Online (Sandbox Code Playgroud)