Java StringBuffer .lastIndexOf ( String str)
Syntax
StringBuffer.lastIndexOf(String str) has the following syntax.
public int lastIndexOf(String str)
Example
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 . c om*/
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.