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