StringBuffer.lastIndexOf(String str) has the following syntax.
public int lastIndexOf(String str)
In the following code shows how to use StringBuffer.lastIndexOf(String str) method.
public class Main { // w w w . j a v a 2 s . com public static void main(String[] arg) { StringBuffer phrase = new StringBuffer("java2s.com"); int position = phrase.lastIndexOf(".com"); System.out.println(position); } }
The code above generates the following result.