Functions
str.endswith()
Returns true if the source string ends with the substring specified in str, false otherwise.
Syntax · 1 of 4
str.endswith(const string source, const string suffix) → const bool
Arguments
source required const string Source string. suffix required const string The substring to search for. Return Type
const bool Syntax · 2 of 4
str.endswith(input string source, input string suffix) → input bool
Arguments
source required input string Source string. suffix required input string The substring to search for. Return Type
input bool Syntax · 3 of 4
str.endswith(simple string source, simple string suffix) → simple bool
Arguments
source required simple string Source string. suffix required simple string The substring to search for. Return Type
simple bool Syntax · 4 of 4
str.endswith(series string source, series string suffix) → series bool
Arguments
source required series string Source string. suffix required series string The substring to search 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)