LAST_INDEX_OF
Description
Returns the starting position (zero-based index) of the last occurrence of substring within string. The search is case-sensitive. If end_position_optional is provided, the search considers characters from the start of the string up to the specified end position. Returns -1 if the substring is not found.
Syntax
LAST_INDEX_OF(string, substring, end_position_optional) -> Integer
Parameters
| Parameter | Data Type | Required | Description |
|---|---|---|---|
| string | String | Yes | The string to search within. |
| substring | String | Yes | The substring to locate. |
| end_position_optional | Integer | No | The zero-based index indicating the end position for the search. If omitted, searches the entire string. |
Examples
LAST_INDEX_OF("ERR_100|DONE|ERR_200|DONE", "ERR_", 8)
-- Returns 0. Finds "ERR_" at index 0 within the first 8 characters.LAST_INDEX_OF("Status: Info, Status: Warn", "status")
-- Returns -1 (no match, case-sensitive).