Skip to main content

Index Of

Module Info:

moduleType: "internal",
moduleName: "indexOf"

Description

The indexOf function receives a string and a search substring, then returns the index of the first occurrence substring inside the primary string. If the substring does not exist inside the string -1 is returned.

Inputs

NameTypeRequired
stringstring
searchstring

Outputs

NameType
indexnumber

Examples

Inputs Outputs
string search index
"Hello Yellow Submarine" "e" 1
"Hello Yellow Submarine" "Yellow" 6
"Hello Yellow Submarine" "foo" -1