How to create a string with a repeated character N times in Kotlin

1 Answer

0 votes
fun main() {
    val repeated = "*".repeat(10) // Repeats '*' 10 times
    
    println(repeated)
}


 
  
/*
run:
 
**********

*/

 



answered Jul 28, 2025 by avibootz
...