str.repeat

Produces a string made of repeated copies of another, with the option of something between the copies. The string and the count are required; the separator is not.

str.repeat(const string source, const int count, const string separator) → const string
str.repeat(input string source, input int count, input string separator) → input string
str.repeat(series string source, series int count, series string separator) → series string
str.repeat(simple string source, simple int count, simple string separator) → simple string
ParameterTypeRequiredDescription
sourceconst stringyesthe string to repeat
countconst intyeshow many copies to produce
separatorconst stringnooptional text to place between the copies

Returns const string or input string or series string or simple string — A string in the form of the arguments you pass.

indicator("Repeated text")
alert(str.repeat("ab", 3))
plot(close)

See also str.contains · str.endswith · str.format_time

Part of the function index.

Ready to put this into practice?
Try GoCharting Premium
Unlock advanced orderflow, market profile, options desk, and real-time data — everything you just read about, live in your charts.
Upgrade