Jun 01 2019
03:37 PM
- last edited on
Apr 07 2022
05:50 PM
by
TechCommunityAP
Jun 01 2019
03:37 PM
- last edited on
Apr 07 2022
05:50 PM
by
TechCommunityAP
documentation copied from indexof
Function reports the zero-based index of the last occurrence of a specified string within input string.
If lookup or input string is not of string type - forcibly casts the value to string.
Syntax
lastindexof(source,lookup[,start_index[,length]])
Arguments
Returns
Zero-based index position of lookup.
Returns -1 if the string is not found in the input.
In case of irrelevant (less than 0) start_index or length parameter - returns null.
Examples
print idx1 = lastindexof("/abc/cde/fgh", "/") // lookup found in input string , idx2 = lastindexof("/abc/cde/fgh", "/", 1, 6) // lookup found in researched range , idx3 = lastindexof("/abc/cde/fgh", "/", 1, 2) // search starts from index 1, but stops after 2 chars, so full lookup can't be found , idx4 = lastindexof("/abc/cde/fgh", "/", 0, 3) // search starts after occurrence of lookup , idx5 = lastindexof("/abc/cde/fgh", "/", -1) // invalid input , idx6 = lastindexof(1231231, 2) // two first parameters were forcibly cast to strings "1231231" and "2"
idx1 idx2 idx3 idx4 idx5 idx6
8 | 4 | -1 | 0 | 4 |
Jun 02 2019 08:27 AM