reversefind-substring
Returns the position of the last occurrence of substr within string. By default, the function starts the search from the first character, which has position (index) 1, and ends the search at the last character, but you can optionally specify an ending index. If substr cannot be found, then the function returns 0.
Languages
Built-in, C++, C#, Java.
Parameters
Name | Type | Description |
---|---|---|
string | xs:string | The input string. |
substr | xs:string | The sub-string to search for. |
endindex | xs:int | Optional. Specifies the ending position (index) of the search. If this parameter is not specified, the search ends after the last character in string. |
Example
The following mapping outputs 8, which is the position of the last occurrence of the pipe character in the input string id|name|email.
If you specify 4 as ending index, then the function searches up to the fourth character. Consequently, the mapping below outputs 3.