Java StringBuffer.indexOf(String str)
Syntax
StringBuffer.indexOf(String str) has the following syntax.
public int indexOf(String str)
Example
In the following code shows how to use StringBuffer.indexOf(String str) method.
public class Main{
public static void main(String args[]) {
StringBuffer sb = new StringBuffer();
sb.append("java2s.com");
int index = sb.indexOf("a");
System.out.println(index);/*ww w.ja v a 2s. co m*/
}
}
The code above generates the following result.