repeat

actual fun CharSequence.repeat(n: Int): String (source)

Returns a string containing this char sequence repeated n times.



fun main(args: Array<String>) {
//sampleStart
println("Word".repeat(4)) // WordWordWordWord
println("Word".repeat(0)) //
//sampleEnd
}

Exceptions

IllegalArgumentException - when n < 0.