Java Data Type Tutorial - Java StringBuilder.delete(int start, int end)








Syntax

StringBuilder.delete(int start, int end) has the following syntax.

public StringBuilder delete(int start,   int end)

Example

In the following code shows how to use StringBuilder.delete(int start, int end) method.

public class Main {
  public static void main(String[] argv) {
    StringBuilder sb = new StringBuilder();
    sb.append(true);// www .  ja  v  a 2s.  c om
    sb.append("java2s.com");
    
    sb.delete(1, 2);
    System.out.println(sb.toString());
  }
}

The output: