core data - Coredata fetch request using NSPredicate -


i want phone number search in sqlite db. phone table have number field holds string value (eg: +1 (2-34)56-78 ).

if user enters search text "234", need fetch phone numbers digits(eliminating other alphabets or special characters in string stored) using nspredicate , compare entered string. shall using predicate in fetch request?

i tried following predicate , doesnt return me expected result:

nspredicate *predicate = [nspredicate predicatewithformat:@"contactname != null , subquery(phonelist, $phone, $phone.number contains[c] %@).@count > 0",searchtext];

is there way done? can use regular expression nspredicate this?

nspredicate doesn't support kind of matching. core data model should include data app requires filtering-- might mean fields not visible users. if need match numbers without regard non-numeric characters, should add field contains data. if actual string +1 (2-34)56-78, add secondary field store 12345678. use field in predicate.


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -