Lipi Reference Lipi

Functions

str.contains()

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

Syntax · 1 of 4

                str.contains(const string source, const string str) → const bool
              

Arguments

source required const string the string to search in
str required const string the string to look for

Return Type

const bool

Syntax · 2 of 4

                str.contains(input string source, input string str) → input bool
              

Arguments

source required input string the string to search in
str required input string the string to look for

Return Type

input bool

Syntax · 3 of 4

                str.contains(simple string source, simple string str) → simple bool
              

Arguments

source required simple string the string to search in
str required simple string the string to look for

Return Type

simple bool

Syntax · 4 of 4

                str.contains(series string source, series string str) → series bool
              

Arguments

source required series string the string to search in
str required series string the string to look for

Return Type

series bool

Example


          indicator("String Contains Example", overlay=false)
ticker = syminfo.ticker
isForex = str.contains(ticker, "USD")
plot(isForex ? 1 : 0, title="Contains USD", color=isForex ? color.green : color.red, style=plotStyle.bar)