Unicode

public final class Unicode: CollationProtocol

Unicode Collation that will compare two strings by using Unicode collation algorithm. If the locale is not specified, the collation is Unicode-aware but not localized; for example, accented Roman letters sort right after the base letter (This is implemented by using the en_US locale).

  • Specifies whether the collation is case-insenstive or not. Case-insensitive collation will treat ASCII uppercase and lowercase letters as equivalent.

    Declaration

    Swift

    public func ignoreCase(_ ignoreCase: Bool) -> Self

    Parameters

    ignoreCase

    True for case-insenstivie; false for case-senstive.

    Return Value

    The Unicode Collation object.

  • Specifies whether the collation ignore the accents or diacritics when comparing the strings or not.

    Declaration

    Swift

    public func ignoreAccents(_ ignoreAccents: Bool) -> Self

    Parameters

    ignoreAccents

    True for accent-insenstivie; false for accent-senstive.

    Return Value

    The Unicode Collation object.

  • Specifies the locale to allow the collation to compare strings appropriately base on the locale.

    Declaration

    Swift

    public func locale(_ locale: String?) -> Self

    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 ‘en_US’ will be used by default.

    Return Value

    The Unicode Collation object.