str.replace_all

Substitutes new text for every occurrence of the old text. It takes no count. That is the difference between it and str.replace, which does.

str.replace_all(const string source, const string old, const string new) → const string
str.replace_all(input string source, input string old, input string new) → input string
str.replace_all(series string source, series string old, series string new) → series string
str.replace_all(simple string source, simple string old, simple string new) → simple string
ParameterTypeRequiredDescription
sourceconst stringyesthe string to work on
oldconst stringyesthe text to replace
newconst stringyesthe text to put in its place

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

indicator("Every replacement")
alert(str.replace_all("a-b-c", "-", ":"))
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