StringBuilder.indexOf(String str) has the following syntax.
public int indexOf(String str)
In the following code shows how to use StringBuilder.indexOf(String str) method.
// w w w. j av a 2 s. c om public class Main{ public static void main(String args[]) { StringBuilder sb = new StringBuilder(); sb.append("java2s.com"); int index = sb.indexOf("a"); System.out.println(index); } }
The code above generates the following result.