Computer Applications
Mention the purpose and syntax of compareToIgnore() method.
Java String Handling
1 Like
Answer
The compareToIgnore() method compares two strings lexicographically, ignoring case differences in the strings. It returns a value based on the following logic:
- if string1 > string2 the result will be a positive integer, i.e., result > 0
- if string1 < string2 the result will be a negative integer, i.e., result < 0
- if string1 = string2 the result will be 0, i.e., result = 0
Syntax:string1.compareToIgnore(string2)
Answered By
1 Like