public
int indexOf(String str)
Returns
the index within this string of the first occurrence of the specified
substring.
public class StringBufferIndexOf { public static void main(String args[]){ StringBuffer str1 = new StringBuffer("Hi How are you"); System.out.print("Index of \"How\" is "); System.out.println(str1.indexOf("How")); } }
Output
Index of "How" is 3
No comments:
Post a Comment