Returns the position of the first occurrence of substr within string. By default, the function starts the search from the first character, which has position (index) 1, but you can optionally specify a specific starting index. If substr cannot be found, then the function returns 0.
Built-in, C++, C#, Java.
The input string.
The sub-string to search for.
Optional. Specifies the starting position (index) of the search. If this parameter is not specified, the search starts at position 1.
The following mapping outputs 3, which is the position of the first occurrence of the pipe character in the input string id|name|email.
If you specify 4 as starting index, then the function starts searching from the fourth character. Consequently, the mapping below outputs 8, which is the first occurrence of the pipe character after searching from the fourth character onwards.