last index of
finds the last occurrence of a substring in a string
(string subject, string search, long end) -> long
If subject
contains search
at or before index end
, returns the index of the last such occurrence. Returns -1
otherwise.
If end
is nil
, it is interpreted as the last index of subject
.
Returns nil
if subject
is nil
or search
is nil
.
Parameters
Name | Type | Description |
---|---|---|
subject |
string | The string to search in |
search |
string | The string to find |
end |
long |
The index of the last character where search should begin. Indexes are zero-based, i.e. the first character is at index 0. Set to |