public
int indexOf(String str, int fromIndex)
Returns
the index within this string of the first occurrence of the specified
substring, starting at the specified index.
class StringIndexOfString{ public static void main(String args[]){ String s1 = new String("abbababdeabbababde"); System.out.println("s1 = " + s1); System.out.print("String abde at index "); System.out.println(s1.indexOf("abde", 6)); } }
Output
s1 = abbababdeabbababde String abde at index 14
No comments:
Post a Comment