str.contains() - Pine Script Function
str.contains()
Section titled “str.contains()”Overview
Section titled “Overview”Returns true if the source string contains the str substring, false otherwise.
Syntax
Section titled “Syntax”str.contains(source, str) → const boolParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| source | const string | Source string. |
Returns
Section titled “Returns”True if the str was found in the source string, false otherwise.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”//@version=6indicator("str.contains")// If the current chart is a continuous futures chart, e.g “BTC1!”, then the function willreturn true, false otherwise.var isFutures = str.contains(syminfo.tickerid, "!")plot(isFutures ? 1 : 0)