String.repeat

String.repeat

String.repeat

Function

Repeat the current string the number of times.

Syntax

Parameters

ParametersTypeRequiredDefault valueDescription
countIntNo0Number of repetitions, negative numbers will be treated as 0.

Return value

TypeDescription
StringReturns the new string after repetition.

Example

Notes

  • Returns an empty string when count is 0 or negative.