Functions
str.endswith()
Asks whether a string finishes with a given ending. The suffix is a string, not a pattern, and both arguments are required.
Syntax · 1 of 4
str.endswith(const string source, const string suffix) → const bool
Arguments
source required const string the string being examined suffix required const string the ending to test for Return Type
const bool Syntax · 2 of 4
str.endswith(input string source, input string suffix) → input bool
Arguments
source required input string the string being examined suffix required input string the ending to test for Return Type
input bool Syntax · 3 of 4
str.endswith(simple string source, simple string suffix) → simple bool
Arguments
source required simple string the string being examined suffix required simple string the ending to test for Return Type
simple bool Syntax · 4 of 4
str.endswith(series string source, series string suffix) → series bool
Arguments
source required series string the string being examined suffix required series string the ending to test for Return Type
series bool Example
indicator("String Contains Example", overlay=false)
ticker = syminfo.ticker
isForex = str.endswith(ticker, "USD")
plot(isForex ? 1 : 0, title="Contains USD", color=isForex ? color.green : color.red, style=plotStyle.bar)