StringQuery

public final class StringQuery<T: Reflectable>: NilComparable, Matchable

A class that queries against String properties in the T class.

  • A class that queries against String properties in the T class.

    Declaration

    Swift

    public let builder: PredicateBuilder<T>
  • A class that queries against String properties in the T class.

    Declaration

    Swift

    public let property: String
  • Undocumented

    Declaration

    Swift

    public final class StringQuery<T: Reflectable>: NilComparable, Matchable
  • Convenience function for StringQuery’s equals(string:) function where we pass an empty string through.

    Declaration

    Swift

    @discardableResult public func isEmpty() -> FinalizedIncluder<T>
  • Equivalent to the BEGINSWITH operator. Equivalent to creating this predicate:

    class Kraken {
        var name: String
    }
    NSPredicate(format: "name BEGINSWITH \"K\"")
    

    Fetch the `Kraken` object if the value of its `name` property begins with the letter ‘K’

    • Parameters:
    • string: The string to match the property’s value against.
    • options: Used to describe the sensitivity (diacritic or case) of the string comparator operation. Defaults to PredicateOptions.None
    • file: Name of the file the function is being called from. Defaults to #file
    • line: Number of the line the function is being called from. Defaults to #line

    Declaration

    Swift

    @discardableResult public func beginsWith(_ string: String, options: PredicateOptions = .None) -> FinalizedIncluder<T>
  • Equivalent to the ENDSWITH operator. Equivalent to creating this predicate:

    class Kraken {
        var name: String
    }
    NSPredicate(format: "name ENDSWITH \"n\"")
    

    Fetch the `Kraken` object if the value of its `name` property ends with the letter ‘n’

    • Parameters:
    • string: The string to match the property’s value against.
    • options: Used to describe the sensitivity (diacritic or case) of the string comparator operation. Defaults to PredicateOptions.None
    • file: Name of the file the function is being called from. Defaults to #file
    • line: Number of the line the function is being called from. Defaults to #line

    Declaration

    Swift

    @discardableResult public func endsWith(_ string: String, options: PredicateOptions = .None) -> FinalizedIncluder<T>
  • Equivalent to the CONTAINS operator. Equivalent to creating this predicate:

    class Kraken {
        var name: String
    }
    NSPredicate(format: "name CONTAINS \"rake\"")
    

    Fetch the `Kraken` object if the value of its `name` property contains the word ‘rake’

    • Parameters:
    • string: The string to match the property’s value against.
    • options: Used to describe the sensitivity (diacritic or case) of the string comparator operation. Defaults to PredicateOptions.None
    • file: Name of the file the function is being called from. Defaults to #file
    • line: Number of the line the function is being called from. Defaults to #line

    Declaration

    Swift

    @discardableResult public func contains(_ string: String, options: PredicateOptions = .None) -> FinalizedIncluder<T>
  • Equivalent to the MATCHES operator. Equivalent to creating this predicate:

    class Kraken {
        var name: String
    }
    NSPredicate(format: "name MATCHES %@", regex)
    

    Fetch the `Kraken` object if the value of its `name` property matches the regular expression pattern stored in the regex variable.

    • Parameters:
    • string: The string to match the property’s value against.
    • options: Used to describe the sensitivity (diacritic or case) of the string comparator operation. Defaults to PredicateOptions.None
    • file: Name of the file the function is being called from. Defaults to #file
    • line: Number of the line the function is being called from. Defaults to #line

    Declaration

    Swift

    @discardableResult public func matches(_ string: String, options: PredicateOptions = .None) -> FinalizedIncluder<T>
  • Equivalent to the == operator. Equivalent to creating this predicate:

    class Kraken {
        var name: String
    }
    NSPredicate(format: "name == \"Kraken\"")
    

    Fetch the `Kraken` object if the value of its `name` property equals the word ‘Kraken’

    • Parameters:
    • string: The string to match the property’s value against.
    • options: Used to describe the sensitivity (diacritic or case) of the string comparator operation. Defaults to PredicateOptions.None
    • file: Name of the file the function is being called from. Defaults to #file
    • line: Number of the line the function is being called from. Defaults to #line

    Declaration

    Swift

    @discardableResult public func equals(_ string: String) -> FinalizedIncluder<T>