Java StringBuilder .deleteCharAt ( int index)

Syntax

StringBuilder.deleteCharAt(int index) has the following syntax.

public StringBuilder deleteCharAt(int index)

Example

In the following code shows how to use StringBuilder.deleteCharAt(int index) method.


public class Main {
  public static void main(String args[]) {
    StringBuilder sb = new StringBuilder("java2s.com.");
/* ww w.j  a v a 2  s  .c  om*/

    sb.deleteCharAt(0);
    System.out.println("After deleteCharAt: " + sb);
  }
}

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