repeat

Returns a string containing this char sequence repeated n times.

Since Kotlin

1.0

Throws

Samples

import java.util.Locale
import kotlin.test.*

fun main() { 
   //sampleStart 
   println("Word".repeat(4)) // WordWordWordWord
println("Word".repeat(0)) // 
   //sampleEnd
}

Returns a string containing this char sequence repeated n times.

Since Kotlin

1.1

Throws

Samples

import java.util.Locale
import kotlin.test.*

fun main() { 
   //sampleStart 
   println("Word".repeat(4)) // WordWordWordWord
println("Word".repeat(0)) // 
   //sampleEnd
}

Returns a string containing this char sequence repeated n times.

Since Kotlin

1.0

Throws

Samples

import java.util.Locale
import kotlin.test.*

fun main() { 
   //sampleStart 
   println("Word".repeat(4)) // WordWordWordWord
println("Word".repeat(0)) // 
   //sampleEnd
}

Returns a string containing this char sequence repeated n times.

Since Kotlin

1.3

Throws

Samples

import java.util.Locale
import kotlin.test.*

fun main() { 
   //sampleStart 
   println("Word".repeat(4)) // WordWordWordWord
println("Word".repeat(0)) // 
   //sampleEnd
}