--- title: "lastIndexOf" description: "Searches for the last occurrence of the substring inside of string." --- # lastIndexOf > Searches for the last occurrence of the substring inside of string. **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 ```python title="Code Snippet" lastIndexOf("Hamburger", "urge") //returns 4 ``` ```python title="Code Snippet" lastIndexOf("Test", "") //returns 4 ``` ```python title="Code Snippet" lastIndexOf("Dysfunctional", "fun") //returns 3 ``` ```python title="Code Snippet" lastIndexOf("Dysfunctional", "marble") //returns -1 ``` ```python title="Code Snippet" lastIndexOf("banana", "n") //returns 4 ```