Skip to main content

$$indexof

Finds the index of the first occurrence of the specified substring with optional from index (returns -1 if not found)

Usage​

{ 
"$$indexof": /* The string to search in */,
"substring": /* string */,
"from": /* integer */
}
"$$indexof(<substring>,[from]):{input}"

Returns​

number

Arguments​

ArgumentTypeValuesRequired / Default ValueDescription
InputstringYesThe string to search in
substringstringYesThe substring to look for
fromintegernullFrom which index to look for

Examples​

Input

Definition

Output

"ABC"
{
"$$indexof": "$",
"substring": "BC"
}
1
"ABCABC"
{
"$$indexof": "$",
"substring": "B",
"from": 2
}
4
"ABC"
{
"$$indexof": "$",
"substring": "D"
}
-1
"ABC"
"$$indexof(BC):$"
1
"ABC"
"$$indexof(D):$"
-1