Scala String contentEquals() method with example
Last Updated :
03 Oct, 2019
The contentEquals() method is utilized to compare a string to the content of StringBuffer.
Method Definition: Boolean contentEquals(StringBuffer sb)
Return Type: It returns true if the content is equal to the stated string else it returns false.
Example #1:
object GfG
{
def main(args : Array[String])
{
val m 1 = new StringBuffer( "Nidhi" )
val result = "Nidhi" .contentEquals(m 1 )
println(result)
}
}
|
Example #2:
object GfG
{
def main(args : Array[String])
{
val m 1 = new StringBuffer( "Nidhi" )
val result = "nidhi" .contentEquals(m 1 )
println(result)
}
}
|
Share your thoughts in the comments
Please Login to comment...