Match NSPredicate with String

I have this predicate that works somewhat well.

NSPredicate *filter = [NSPredicate predicateWithFormat:@"code contains[cd] %@", predicateFilter];

So, if predicateFilter is 112, it finds all the code that has 112 in it. I want him to find all the code that is BEGIN with 112 .

Edit:

I have this predicate, how can I make it so that the codes are between the code that starts with predicateFilterStart and the code that starts with 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]]; 
+4
source share
1 answer
 NSPredicate *filter = [NSPredicate predicateWithFormat:@"code beginswith[cd] %@", predicateFilter]; 

Predicate Programming Guide

+8
source

All Articles