Java String indexOf() | Java String lastIndexOf()

indexOf(String str) Returns the index of the first occurrence of the specified substring within this string. Syntax: public int indexOf(String str)   Note: If no such occurrence of a substring within this string then it returns -1. lastIndexOf(String str) Returns the index of the last occurrence of the specified substring within this string. Syntax: public int lastIndexOf(String str)   Note: If … Read more