iOS NSPredicate

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Syntax

  • Predicate Format String Substitions
    • C format string specifiers: %d, %s, %f, etc
    • Object substitution: %@
    • Keypath substitution: %K
  • Predicate Comparison Operators
    • =, ==: Left-hand expression equals right-hand expression
    • >=, =>: Left-hand expression is greater than or equal to right-hand expression
    • <=, =<: Left-hand expression is less than or equal to right-hand expression
    • >: Left-hand expression is greater than right-hand expression
    • <: Left-hand expression is less than right-hand expression
    • !=, <>: Left-hand expression is not equal to right-hand expression
    • BETWEEN: Left-hand expression is between or equal to either of the values in the right-hand expression, which specifies lower and upper bounds - ex: BETWEEN { 0, 5 }
  • Predicate Compound Operators
    • AND, &&: Logical AND
    • OR, ||: Logical OR
    • NOT, !: Logical NOT
  • Predicate String Comparison Operators
    • BEGINSWITH: Left-hand expression begins with right-hand expression
    • ENDSWITH: Left-hand expression ends with right-hand expression
    • CONTAINS: Left-hand expression contains right-hand expression
    • LIKE: Left-hand expression equals right-hand expression, with wildcard substitution
      • *: Match zero or more characters
      • ?: Match one character


Got any iOS Question?