To create an empty string in Kotlin, you can simply assign an empty value to a variable of type String.
In this example,
emptyString
and assign it an empty string value.emptyString
now holds an empty string.fun main() {
val emptyString = ""
println("Empty string created: '$emptyString'")
}
Empty string created: ''
In this tutorial, we learned How to Create an Empty String in Kotlin language with well detailed examples.