str.endswith
Asks whether a string finishes with a given ending. The suffix is a string, not a pattern, and both arguments are required.
str.endswith(const string source, const string suffix) → const boolstr.endswith(input string source, input string suffix) → input boolstr.endswith(series string source, series string suffix) → series boolstr.endswith(simple string source, simple string suffix) → simple bool| Parameter | Type | Required | Description |
|---|---|---|---|
source | const string | yes | the string being examined |
suffix | const string | yes | the ending to test 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 ends with USD")
plotshape(str.endswith(syminfo.ticker, "USD"), title = "Ends with USD")See also str.contains · 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.