带有示例的 Scala String toLowerCase() 方法
toLowerCase()方法用于将 String 中的所有字符转换为小写。
Method Definition: String toLowerCase()
Return Type: It returns the resultant string after converting each character of the string into the lowercase.
示例:1#
// Scala program of toLowerCase()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying toLowerCase method
val result = "NIDHI".toLowerCase()
// Displays output
println(result)
}
}
输出:
nidhi
示例:2#
// Scala program of toLowerCase()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying toLowerCase method
val result = "gEEKs".toLowerCase()
// Displays output
println(result)
}
}
输出:
geeks