Kotlin .lowercase()
Published Jan 14, 2024Updated May 29, 2025
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.
Syntax
String.lowercase()
String: The string to be converted to lowercase.
Example
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!
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn Kotlin on Codecademy
- Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
- Includes 6 Courses
- With Professional Certification
- Beginner Friendly.75 hours
- Learn Kotlin, the expressive, open-source programming language developed by JetBrains.
- Beginner Friendly.9 hours