Top | Previous | Next |
Strings / lastIndexOf |
lastIndexOf(string, substring) 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.
lastIndexOf("Hamburger", "urge") ...returns 4
lastIndexOf("Test", "") ...returns 4
lastIndexOf("Dysfunctional", "fun") ...returns 3
lastIndexOf("Dysfunctional", "marble") ...returns -1
lastIndexOf("banana", "n") ...returns 4 |