I want to compare two strings in scala. for example,
My Strings are:
scala java
scala java c++
scala c++
I want to compare the string
" scala c++" with each strings
Results should be,
scala c++ = scala java // false
scala c++ = scala java c++ // false
scala c++ = scala c++ // true
In Scala you can use
==
for equalityThe == method is defined in the AnyRef class. Since the methods first checks for null values, and then calls the equals method on the first object to see if the two objects are equals you dont have to do a special null check;
See the Scala getting started guide and strings
From "An Overview of the Scala Programming Language Second Edition";