String.CompareToIgnoreCase(String) 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.
Compares two strings lexicographically, ignoring case differences.
[Android.Runtime.Register("compareToIgnoreCase", "(Ljava/lang/String;)I", "")]
public int CompareToIgnoreCase (string str);
[<Android.Runtime.Register("compareToIgnoreCase", "(Ljava/lang/String;)I", "")>]
member this.CompareToIgnoreCase : string -> int
Parameters
- str
- String
the String
to be compared.
Returns
a negative integer, zero, or a positive integer as the specified String is greater than, equal to, or less than this String, ignoring case considerations.
- Attributes
Exceptions
if string
is null
.
Remarks
Compares two strings lexicographically, ignoring case differences. This method returns an integer whose sign is that of calling compareTo
with normalized versions of the strings where case differences have been eliminated by calling Character.toLowerCase(Character.toUpperCase(character))
on each character.
Note that this method does <em>not</em> take locale into account, and will result in an unsatisfactory ordering for certain locales. The java.text.Collator
class provides locale-sensitive comparison.
Added in 1.2.
Java documentation for java.lang.String.compareToIgnoreCase(java.lang.String)
.
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.