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.





















Home »
  Java Tutorial »
    java.lang »




Boolean
Byte
Character
Class
Double
Enum
Float
Integer
Long
Math
Number
Object
Package
Process
ProcessBuilder
Runnable
Runtime
SecurityManager
Short
StackTraceElement
StrictMath
String
StringBuffer
StringBuilder
System
Thread
ThreadGroup
ThreadLocal
Throwable