Answers for "replace in kotlin"

1

kotlin replace all

#Example: Program to Remove All Whitespaces in KOTLIN
fun main(args: Array<String>) {
    var sentence = "T    his is b  ett     er."
    println("Original sentence: $sentence")

    sentence = sentence.replace("\s".toRegex(), "")
    println("After replacement: $sentence")
}
Posted by: Guest on June-26-2021

Python Answers by Framework

Browse Popular Code Answers by Language