How to perform case-insensitive two strings comparison in Java

1 Answer

0 votes
public class Program {
    public static void main(String[] args) {
        String str1 = "profession: java Programmer";
        String str2 = "Profession: JAVA PROGRAMMER";
        
        boolean equals = str1.equalsIgnoreCase(str2);
        
        System.out.println(equals);
    }
}


   
/*
run:
   
true
  
*/

 



answered Feb 24, 2025 by avibootz

Related questions

1 answer 105 views
1 answer 109 views
1 answer 103 views
1 answer 111 views
1 answer 91 views
...