times

operator fun String.times(n: Int): String

Repeats the string n times.

This operator overload allows the use of the * operator to repeat a string.

Example:

val repeated = "abc" * 3 // Result is "abcabcabc"

Return

A new string consisting of the original string repeated n times. Returns an empty string if n is zero or negative.

Parameters

n

The number of times to repeat the string. Must be a non-negative integer.