[Solved] How can I use the compareToIgnoreCase method? [closed]


This routine returns -1, 0, or 1 as values, so you can do something like this:

String first;
String second;
... assign first and second

if( first.compareToIgnoreCase(second) < 0) {
    // second is less than first...
} else if first.compareToIgnoreCase(second) == 0) {
    // second is same as first...
} else if first.compareToIgnoreCase(second) > 0) {
    // second is greater than first...
}

2

solved How can I use the compareToIgnoreCase method? [closed]