다음을 통해 공유


String.EqualsIgnoreCase(String) Method

Definition

Compares this String to another String, ignoring case considerations.

[Android.Runtime.Register("equalsIgnoreCase", "(Ljava/lang/String;)Z", "")]
public bool EqualsIgnoreCase (string? anotherString);
[<Android.Runtime.Register("equalsIgnoreCase", "(Ljava/lang/String;)Z", "")>]
member this.EqualsIgnoreCase : string -> bool

Parameters

anotherString
String

The String to compare this String against

Returns

true if the argument is not null and it represents an equivalent String ignoring case; false otherwise

Attributes

Remarks

Compares this String to another String, ignoring case considerations. Two strings are considered equal ignoring case if they are of the same length and corresponding characters in the two strings are equal ignoring case.

Two characters c1 and c2 are considered the same ignoring case if at least one of the following is true: <ul> <li> The two characters are the same (as compared by the == operator) <li> Calling Character.toLowerCase(Character.toUpperCase(char)) on each character produces the same result </ul>

Note that this method does <em>not</em> take locale into account, and will result in unsatisfactory results for certain locales. The java.text.Collator class provides locale-sensitive comparison.

Java documentation for java.lang.String.equalsIgnoreCase(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.

Applies to