Java StringBuilder .lastIndexOf ( String str)

Syntax

StringBuilder.lastIndexOf(String str) has the following syntax.

public int lastIndexOf(String str)

Example

In the following code shows how to use StringBuilder.lastIndexOf(String str) method.


public class Main {
/*from w  w w.  jav  a 2 s.  c o  m*/
  public static void main(String[] arg) {
    StringBuilder phrase = new StringBuilder("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