Scala String equalsIgnoreCase() method with example
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:
object GfG
{
def main(args : Array[String])
{
val m 1 = Array( 'N' , 'i' , 'd' , 'h' , 'i' )
val result = "Nidhi" .equalsIgnoreCase( "Nidhi" )
println(result)
}
}
|
Example #2:
object GfG
{
def main(args : Array[String])
{
val m 1 = Array( 'N' , 'i' , 'd' , 'h' , 'i' )
val result = "Nidhi" .equalsIgnoreCase( "nidhi" )
println(result)
}
}
|
Last Updated :
03 Oct, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...