<last-index-of>
Purpose/Function
Finds the starting index for the first instance of a substring of a given string, searching backwards.
Attributes
NAME |
TYPE |
DEFAULT VALUE |
DESCRIPTION |
---|---|---|---|
string |
|
(required) |
string to search |
substring |
|
(required) |
substring to find |
from |
|
-1 |
starting position (index) of search (default means from the end of the string) |
Elements
None.
ReturnValues
DEFAULT NAME |
TYPE |
DESCRIPTION |
---|---|---|
_lastIndexOfResult |
|
index of the first character of the substring |
Examples
<ogrescript> <declare name="s0" string="woruqpoweiurvnsadbkjs;dlkfjoeiuw"/> <declare name="s1" string="sad"/> <declare name="i"/> <last-index-of string="${s0}" substring="${s1}"> <return-value defaultName="lastIndexOfResult" assignedName="i"/> </last-index-of> <echo message="${s1} starts at ${i}"/> </ogrescript>