str.contains

Tests whether one string occurs inside another. Both arguments are required, and the function carries one signature per form of them.

str.contains(const string source, const string str) → const bool
str.contains(input string source, input string str) → input bool
str.contains(series string source, series string str) → series bool
str.contains(simple string source, simple string str) → simple bool
ParameterTypeRequiredDescription
sourceconst stringyesthe string to search in
strconst stringyesthe string to look for

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

indicator("Ticker contains ES")
plotshape(str.contains(syminfo.ticker, "ES"), title = "Contains ES")

See also str.endswith · str.format_time · str.length

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