CBLQueryCollation

@interface CBLQueryCollation : NSObject

CBLQueryCollation defines how strings are compared and is used when creating a COLLATE expression. The COLLATE expression can be used in the WHERE clause when comparing two strings or in the ORDER BY clause when specifying how the order of the query results. CouchbaseLite provides two types of the Collation, ASCII and Unicode. Without specifying the COLLATE expression Couchbase Lite will use the ASCII with case sensitive collation by default.

  • Creates an ASCII Collation that compares strings by using binary comparison. If the ignoring case or case-insenstive is specified, the collation will treat ASCII uppercase and lowercase letters as equivalent.

    Declaration

    Objective-C

    + (nonnull CBLQueryCollation *)asciiWithIgnoreCase:(BOOL)ignoreCase;

    Parameters

    ignoreCase

    True for case-insensitive; false for case-sensitive.

    Return Value

    The ASCII Collation.

  • Creates a Unicode Collation that compares strings by using Unicode Collation Algorithm. If the locale is not specified, the current system locale will be used by default.

    Declaration

    Objective-C

    + (nonnull CBLQueryCollation *)unicodeWithLocale:(nullable NSString *)locale
                                          ignoreCase:(BOOL)ignoreCase
                                       ignoreAccents:(BOOL)ignoreAccents;

    Parameters

    locale

    The locale code which is an ISO-639 language code plus, optionally, an underscore and an ISO-3166 country code: “en”, “en_US”, “fr_CA”, etc. Specifing the locale will allow the collation to compare strings appropriately base on the locale. If not specified, the current system locale will be used by default.

    ignoreCase

    True for case-insensitive; false for case sensitive.

    ignoreAccents

    True for accent-insensitive; false for accent-sensitive.

    Return Value

    The Unicode Collation.

  • Not available.

    Declaration

    Objective-C

    - (nonnull instancetype)init;