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
Name | Type | Required |
---|---|---|
string | string | ✔ |
search | string | ✔ |
Outputs
Name | Type |
---|---|
index | number |
Examples
Inputs | Outputs | |
---|---|---|
string | search | index |
"Hello Yellow Submarine" | "e" | 1 |
"Hello Yellow Submarine" | "Yellow" | 6 |
"Hello Yellow Submarine" | "foo" | -1 |