Published Jan 14, 2024
Contribute to Docs

The .lowercase() method in Kotlin changes all characters in a string to lowercase. It does not modify the original string, rather it returns a new transformed string. This is useful when case-sensitive operations are performed.


  • String: The string to be converted to lowercase.


The following example shows how to use the .lowercase() method on a string:

fun main() {
val originalString = "Hello, World!"
val newString = originalString.lowercase()
println("Original String: $originalString")
println("Lowercased String: $newString")

The above code will return the following output:

Original String: Hello, World!
Lowercased String: hello, world!

All contributors

Looking to contribute?

Learn Kotlin on Codecademy