scala string to lower case
To convert a string to lowercase in Scala, you can use the toLowerCase
method provided by the String
class. Here's an example:
val str = "Hello World"
val lowercaseStr = str.toLowerCase
In this code, the toLowerCase
method is called on the str
variable, which contains the string "Hello World". The result is assigned to the lowercaseStr
variable, which will contain the lowercase version of the string.
That's all you need to do to convert a string to lowercase in Scala.