Skip to content
Related Articles

Related Articles

Scala String equalsIgnoreCase() method with example
  • Last Updated : 03 Oct, 2019
GeeksforGeeks - Summer Carnival Banner

The equalsIgnoreCase() method is utilized to check if the stated string and object are equal by ignoring the case difference.

Method Definition: Boolean equalsIgnoreCase(String anotherString)
Return Type: It returns true if the string is same as the object stated by ignoring the case difference, else it returns false.

Example #1:




// Scala program of equalsIgnoreCase()
// method
  
// Creating object
object GfG
  
    // Main method
    def main(args:Array[String])
    {
        // Creating an array
        val m1 = Array('N', 'i', 'd', 'h', 'i')
          
          
        // Applying equalsIgnoreCase() method
        val result = "Nidhi".equalsIgnoreCase("Nidhi")
          
        // Displays output
        println(result)
      
    }
Output:
true

Example #2:




// Scala program of equalsIgnoreCase()
// method
  
// Creating object
object GfG
  
    // Main method
    def main(args:Array[String])
    {
        // Creating an array
        val m1 = Array('N', 'i', 'd', 'h', 'i')
          
          
        // Applying equalsIgnoreCase() method
        val result = "Nidhi".equalsIgnoreCase("nidhi")
          
        // Displays output
        println(result)
      
    }
Output:
true

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.




My Personal Notes arrow_drop_up
Recommended Articles
Page :