ICharSequence.Compare Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
Compare(ICharSequence, ICharSequence) |
Compares two |
Compare(String, String) |
Compares two |
Compare(ICharSequence, ICharSequence)
Compares two CharSequence
instances lexicographically.
[Android.Runtime.Register("compare", "(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)I", "", ApiSince=34)]
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)>]
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 CharSequence
cs 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.
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)
Compares two CharSequence
instances lexicographically.
public static int Compare (string cs1, string cs2);
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.
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 CharSequence
cs 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.
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.