nice to help others
NSPredicate Cheatsheet, Basic, compound, Aggregate, String, comparison operators
Format string summary @"attributeName == %@" object’s attributeName value is equal to value passed in @"%K == %@" pass a string variable to %K, it will be represented as a keypath, then check if it’s value is equal to value passed in @"%name IN $NAME_LIST" templated for predicate, checks if the value of key name is in $NAME_LIST. Uses predicateWithSubstitutionVariables @"'name' IN $NAME_LIST" checks if the constant value ‘name’ is in $NAME_LIST. Uses predicateWithSubstitutionVariables [NSPredicate predicateWithFormat: @"title == %@", @"minecraft"] String comparison operators BEGINSWITH Left hand expression begins with the right hand expression CONTAINS Left hand expression contains the right hand expression ENDSWITH Left hand expression ends with the right hand expression LIKE Left hand expression equals the right hand expression: ? and * are allowed as wildcard characters, where ? matches 1 character and * matches 0
Comments
Post a Comment