Freigeben über


CharSequenceConsts.Compare Method

Definition

Overloads

Compare(ICharSequence, ICharSequence)
Obsolete.

Compares two CharSequence instances lexicographically.

Compare(String, String)
Obsolete.

Compares two CharSequence instances lexicographically.

Compare(ICharSequence, ICharSequence)

Caution

Use 'Java.Lang.ICharSequence.Compare'. This class will be removed in a future release.

Compares two CharSequence instances lexicographically.

[Android.Runtime.Register("compare", "(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)I", "", ApiSince=34)]
[System.Obsolete("Use 'Java.Lang.ICharSequence.Compare'. This class will be removed in a future release.")]
public static int Compare (Java.Lang.ICharSequence cs1, Java.Lang.ICharSequence cs2);
[<Android.Runtime.Register("compare", "(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)I", "", ApiSince=34)>]
[<System.Obsolete("Use 'Java.Lang.ICharSequence.Compare'. This class will be removed in a future release.")>]
static member Compare : Java.Lang.ICharSequence * Java.Lang.ICharSequence -> int

Parameters

cs1
ICharSequence

the first CharSequence

cs2
ICharSequence

the second CharSequence

Returns

the value 0 if the two CharSequence are equal; a negative integer if the first CharSequence is lexicographically less than the second; or a positive integer if the first CharSequence is lexicographically greater than the second.

Attributes

Remarks

Compares two CharSequence instances lexicographically. Returns a negative value, zero, or a positive value if the first sequence is lexicographically less than, equal to, or greater than the second, respectively.

The lexicographical ordering of CharSequence is defined as follows. Consider a CharSequencecs of length len to be a sequence of char values, cs[0] to cs[len-1]. Suppose k is the lowest index at which the corresponding char values from each sequence differ. The lexicographic ordering of the sequences is determined by a numeric comparison of the char values cs1[k] with cs2[k]. If there is no such index k, the shorter sequence is considered lexicographically less than the other. If the sequences have the same length, the sequences are considered lexicographically equal.

Added in 11.

Java documentation for java.lang.CharSequence.compare(java.lang.CharSequence, java.lang.CharSequence).

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)

Caution

Use 'Java.Lang.ICharSequence.Compare'. This class will be removed in a future release.

Compares two CharSequence instances lexicographically.

[System.Obsolete("Use 'Java.Lang.ICharSequence.Compare'. This class will be removed in a future release.")]
public static int Compare (string cs1, string cs2);
[<System.Obsolete("Use 'Java.Lang.ICharSequence.Compare'. This class will be removed in a future release.")>]
static member Compare : string * string -> int

Parameters

cs1
String

the first CharSequence

cs2
String

the second CharSequence

Returns

the value 0 if the two CharSequence are equal; a negative integer if the first CharSequence is lexicographically less than the second; or a positive integer if the first CharSequence is lexicographically greater than the second.

Attributes

Remarks

Compares two CharSequence instances lexicographically. Returns a negative value, zero, or a positive value if the first sequence is lexicographically less than, equal to, or greater than the second, respectively.

The lexicographical ordering of CharSequence is defined as follows. Consider a CharSequencecs of length len to be a sequence of char values, cs[0] to cs[len-1]. Suppose k is the lowest index at which the corresponding char values from each sequence differ. The lexicographic ordering of the sequences is determined by a numeric comparison of the char values cs1[k] with cs2[k]. If there is no such index k, the shorter sequence is considered lexicographically less than the other. If the sequences have the same length, the sequences are considered lexicographically equal.

Added in 11.

Java documentation for java.lang.CharSequence.compare(java.lang.CharSequence, java.lang.CharSequence).

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