Java Data Type Tutorial - Java StringBuffer .lastIndexOf ( String str, int fromIndex)








Syntax

StringBuffer.lastIndexOf(String str, int fromIndex) has the following syntax.

public int lastIndexOf(String str,  int fromIndex)

Example

In the following code shows how to use StringBuffer.lastIndexOf(String str, int fromIndex) method.

//www.  j a  v  a 2 s  . c  o m
public class Main {

  public static void main(String[] arg) {

    StringBuffer buffer = new StringBuffer("from java2s.com");
    
    System.out.println(buffer.lastIndexOf("a",10));
  }

}

The code above generates the following result.