Skip to content
AlertaChartAlertaScript / docs
AlertaScript / alerta.str.replace
On this pageSignatureParametersReturnsExample

Utilities / Reference

alerta.str.replace

TradingView-compatible spelling: str.replace, runs without warnings

Replaces one occurrence of target with replacement — the first unless occurrence says otherwise.

alerta.str.replace(source, target, replacement, occurrence) → series string

Parameters

NameTypeRequiredDefaultDescription
sourceseries stringYes—Source string.
targetseries stringYes—Target to replace.
replacementseries stringYes—Replacement string.
occurrenceseries intNo—Which occurrence of target to replace, counting from 0 (the first). The source comes back unchanged when there are fewer. Default 0.

Returns

series string

Example

alerta.str.replace
indicator("Replace Example")// Remove BINANCE: prefix from the symbolconst cleanSymbol = str.replace(syminfo.tickerid, "BINANCE:", "")if barstate.islast    label.new(bar_index, high, cleanSymbol)

Names and aliases

Guides and navigation are localized. Built-in reference descriptions and code examples are maintained in English.

AlertaScript

No results found.

Search by name, alias, or keyword.