Share via


Normalizer.Compare Method

Definition

Overloads

Compare(Char[], Char[], NormalizerCompareOptions)

Compare two strings for canonical equivalence.

Compare(Int32, Int32, NormalizerCompareOptions)

Convenience method that can have faster implementation by not allocating buffers.

Compare(Int32, String, NormalizerCompareOptions)

Convenience method that can have faster implementation by not allocating buffers.

Compare(String, String, NormalizerCompareOptions)

Compare two strings for canonical equivalence.

Compare(Char[], Int32, Int32, Char[], Int32, Int32, NormalizerCompareOptions)

Compare two strings for canonical equivalence.

Compare(Char[], Char[], NormalizerCompareOptions)

Compare two strings for canonical equivalence.

[Android.Runtime.Register("compare", "([C[CI)I", "", ApiSince=24)]
public static int Compare (char[]? s1, char[]? s2, Android.Icu.Text.NormalizerCompareOptions options);
[<Android.Runtime.Register("compare", "([C[CI)I", "", ApiSince=24)>]
static member Compare : char[] * char[] * Android.Icu.Text.NormalizerCompareOptions -> int

Parameters

s1
Char[]

First source string.

s2
Char[]

Second source string.

options
NormalizerCompareOptions

A bit set of options: - FOLD_CASE_DEFAULT or 0 is used for default options: Case-sensitive comparison in code unit order, and the input strings are quick-checked for FCD.

          - INPUT_IS_FCD
            Set if the caller knows that both s1 and s2 fulfill the FCD
            conditions. If not set, the function will quickCheck for FCD
            and normalize if necessary.

          - COMPARE_CODE_POINT_ORDER
            Set to choose code point order instead of code unit order

          - COMPARE_IGNORE_CASE
            Set to compare strings case-insensitively using case folding,
            instead of case-sensitively.
            If set, then the following case folding options are used.

Returns

&lt;0 or 0 or &gt;0 as usual for string comparisons

Attributes

Remarks

Compare two strings for canonical equivalence. Further options include case-insensitive comparison and code point order (as opposed to code unit order). Convenience method.

Java documentation for android.icu.text.Normalizer.compare(char[], char[], int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Compare(Int32, Int32, NormalizerCompareOptions)

Convenience method that can have faster implementation by not allocating buffers.

[Android.Runtime.Register("compare", "(III)I", "", ApiSince=24)]
public static int Compare (int char32a, int char32b, Android.Icu.Text.NormalizerCompareOptions options);
[<Android.Runtime.Register("compare", "(III)I", "", ApiSince=24)>]
static member Compare : int * int * Android.Icu.Text.NormalizerCompareOptions -> int

Parameters

char32a
Int32

the first code point to be checked against the

char32b
Int32

the second code point

options
NormalizerCompareOptions

A bit set of options

Returns

Attributes

Remarks

Convenience method that can have faster implementation by not allocating buffers.

Java documentation for android.icu.text.Normalizer.compare(int, int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Compare(Int32, String, NormalizerCompareOptions)

Convenience method that can have faster implementation by not allocating buffers.

[Android.Runtime.Register("compare", "(ILjava/lang/String;I)I", "", ApiSince=24)]
public static int Compare (int char32a, string? str2, Android.Icu.Text.NormalizerCompareOptions options);
[<Android.Runtime.Register("compare", "(ILjava/lang/String;I)I", "", ApiSince=24)>]
static member Compare : int * string * Android.Icu.Text.NormalizerCompareOptions -> int

Parameters

char32a
Int32

the first code point to be checked against

str2
String

the second string

options
NormalizerCompareOptions

A bit set of options

Returns

Attributes

Remarks

Convenience method that can have faster implementation by not allocating buffers.

Java documentation for android.icu.text.Normalizer.compare(int, java.lang.String, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Compare(String, String, NormalizerCompareOptions)

Compare two strings for canonical equivalence.

[Android.Runtime.Register("compare", "(Ljava/lang/String;Ljava/lang/String;I)I", "", ApiSince=24)]
public static int Compare (string? s1, string? s2, Android.Icu.Text.NormalizerCompareOptions options);
[<Android.Runtime.Register("compare", "(Ljava/lang/String;Ljava/lang/String;I)I", "", ApiSince=24)>]
static member Compare : string * string * Android.Icu.Text.NormalizerCompareOptions -> int

Parameters

s1
String

First source string.

s2
String

Second source string.

options
NormalizerCompareOptions

A bit set of options: - FOLD_CASE_DEFAULT or 0 is used for default options: Case-sensitive comparison in code unit order, and the input strings are quick-checked for FCD.

          - INPUT_IS_FCD
            Set if the caller knows that both s1 and s2 fulfill the FCD
            conditions. If not set, the function will quickCheck for FCD
            and normalize if necessary.

          - COMPARE_CODE_POINT_ORDER
            Set to choose code point order instead of code unit order

          - COMPARE_IGNORE_CASE
            Set to compare strings case-insensitively using case folding,
            instead of case-sensitively.
            If set, then the following case folding options are used.

Returns

&lt;0 or 0 or &gt;0 as usual for string comparisons

Attributes

Remarks

Compare two strings for canonical equivalence. Further options include case-insensitive comparison and code point order (as opposed to code unit order).

Canonical equivalence between two strings is defined as their normalized forms (NFD or NFC) being identical. This function compares strings incrementally instead of normalizing (and optionally case-folding) both strings entirely, improving performance significantly.

Bulk normalization is only necessary if the strings do not fulfill the FCD conditions. Only in this case, and only if the strings are relatively long, is memory allocated temporarily. For FCD strings and short non-FCD strings there is no memory allocation.

Semantically, this is equivalent to

strcmp[CodePointOrder](foldCase(NFD(s1)), foldCase(NFD(s2)))

where code point order and foldCase are all optional.

Java documentation for android.icu.text.Normalizer.compare(java.lang.String, java.lang.String, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Compare(Char[], Int32, Int32, Char[], Int32, Int32, NormalizerCompareOptions)

Compare two strings for canonical equivalence.

[Android.Runtime.Register("compare", "([CII[CIII)I", "", ApiSince=24)]
public static int Compare (char[]? s1, int s1Start, int s1Limit, char[]? s2, int s2Start, int s2Limit, Android.Icu.Text.NormalizerCompareOptions options);
[<Android.Runtime.Register("compare", "([CII[CIII)I", "", ApiSince=24)>]
static member Compare : char[] * int * int * char[] * int * int * Android.Icu.Text.NormalizerCompareOptions -> int

Parameters

s1
Char[]

First source character array.

s1Start
Int32

start index of source

s1Limit
Int32

limit of the source

s2
Char[]

Second source character array.

s2Start
Int32

start index of the source

s2Limit
Int32

limit of the source

options
NormalizerCompareOptions

A bit set of options: - FOLD_CASE_DEFAULT or 0 is used for default options: Case-sensitive comparison in code unit order, and the input strings are quick-checked for FCD.

          - INPUT_IS_FCD
            Set if the caller knows that both s1 and s2 fulfill the FCD
            conditions.If not set, the function will quickCheck for FCD
            and normalize if necessary.

          - COMPARE_CODE_POINT_ORDER
            Set to choose code point order instead of code unit order

          - COMPARE_IGNORE_CASE
            Set to compare strings case-insensitively using case folding,
            instead of case-sensitively.
            If set, then the following case folding options are used.

Returns

&lt;0 or 0 or &gt;0 as usual for string comparisons

Attributes

Remarks

Compare two strings for canonical equivalence. Further options include case-insensitive comparison and code point order (as opposed to code unit order).

Canonical equivalence between two strings is defined as their normalized forms (NFD or NFC) being identical. This function compares strings incrementally instead of normalizing (and optionally case-folding) both strings entirely, improving performance significantly.

Bulk normalization is only necessary if the strings do not fulfill the FCD conditions. Only in this case, and only if the strings are relatively long, is memory allocated temporarily. For FCD strings and short non-FCD strings there is no memory allocation.

Semantically, this is equivalent to

strcmp[CodePointOrder](foldCase(NFD(s1)), foldCase(NFD(s2)))

where code point order and foldCase are all optional.

Java documentation for android.icu.text.Normalizer.compare(char[], int, int, char[], int, int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to