Groovy – equalsIgnoreCase()

  • Post author:
  • Post category:Groovy
  • Post comments:1 Comment
ignoring

Compares this String to another String, ignoring case considerations.

Syntax

Boolean equalsIgnoreCase(String str)

Parameters

  • Str – the String to compare this String against

Return Value

This method returns true if the argument is not null and the Strings are equal, ignoring case; false otherwise.

Example

Following is an example of the usage of this method −

class Example { 
   static void main(String[] args) { 
      String a = "Hello World"; 
      String b = "HELLO World"; 
      String c = "HELLO WORLD";
		
      println(a.equalsIgnoreCase(b)); 
      println(a.equalsIgnoreCase(c)); 
      println(b.equalsIgnoreCase(c)); 
   } 
}

When we run the above program, we will get the following result −

true 
true 
true

Previous Page:-Click Here

This Post Has One Comment

Leave a Reply