lastIndexOf
This function is used by Ignition's Expression language.
Description
Searches for the last occurrence of the substring inside of string. Returns the index of where substring was found, or -1 if it wasn't found. The first position in the string is position 0.
Syntax
lastIndexOf(string, substring)
Parameters
string string - The string to search through.
string substring - The string to search for.
Results
- string - The index where the substring was last found in the string.
Examples
Code Snippet
lastIndexOf("Hamburger", "urge") //returns 4
Code Snippet
lastIndexOf("Test", "") //returns 4
Code Snippet
lastIndexOf("Dysfunctional", "fun") //returns 3
Code Snippet
lastIndexOf("Dysfunctional", "marble") //returns -1
Code Snippet
lastIndexOf("banana", "n") //returns 4