Delivers the position of the first occurrence of the character string sub in the original. If the character string sub is not contained in the original the return value is: -1.
indexOf(String sub) | ||||
---|---|---|---|---|
Argument | String | sub | ||
Return value | Integer | New position of the first occurrence of the character string sub in the original. If the character string sub is not contained in the original the return value is: -1. |
Formula | Result |
---|---|
='abcd'.indexOf('cd') | 2 |