I have written following program for you. In this following program I use String.equalsIgnoreCase method to compare two string equality regarding it case. It is very easy process. It use ASCII value of string and use this value to compare 2 string. Just try to understand following program.
Code:
package om.techarena.example.lang;
public class EgIgnoreCase {
public static void main(String[] args) {
String upper1 = "xyzcvs";
String mixed1 = "xYZCvS";
if (upper1.equalsIgnoreCase(mixed1)) {
System.out.println("Upper1 and Mixed1 equals.");
}
}
}
Bookmarks