Functions
str.pos()
Reports the position at which one string sits inside another. The result is an int. This edition does not state what that int is counted from, nor what it reads when there is no match, so do not rely on either.
Syntax · 1 of 4
str.pos(const string source, const string str) → const int
Arguments
source required const string str required const string Return Type
const int Syntax · 2 of 4
str.pos(input string source, input string str) → input int
Arguments
source required input string str required input string Return Type
input int Syntax · 3 of 4
str.pos(simple string source, simple string str) → simple int
Arguments
source required simple string str required simple string Return Type
simple int Syntax · 4 of 4
str.pos(series string source, series string str) → series int
Arguments
source required series string str required series string Return Type
series int Example
//@lipi=2
indicator("str.pos Example", overlay=true)
// Show where "USD" appears in the ticker
if barstate.islast {
label.new(bar_index, high, text="USD at position " + str.tostring(str.pos(syminfo.ticker, "USD")))
}