Compares two strings ignoring case.
Parameters |
Description |
str |
The comparison string. |
Returns |
Description |
int |
0 if the two strings are equal ignoring case. |
Usage
String 1 is this object. String 2 is
the parameter. If the two strings are equal ignoring case, the return
value is 0. If the strings are not equal, the return value is string
1 minus string 2 for the first character that differs (using the Unicode
values of the string).
Examples
This example makes an equal comparison.
var cities = new String("Paris Moscow Tokyo");
var string2 = "PARIS MOSCOW TOKYO";
if (cities.compareToIgnoreCase(string2) == 0)
return cities + " == " + string2;
else
return cities + "!= " + string2;