Java Operators

Java Control Statements

Object Oriented Programming

Java Built-in Classes

Java File Handling

Java Error & Exceptions

Java Multithreading

Java Synchronization

Java Networking

Java Collections

Java Interfaces

Java Data Structures

Java Collections Algorithms

Advanced Java

Java Miscellaneous

Java APIs & Frameworks

Java Class References

Java Useful Resources

Java - String Buffer delete() Method



Description

This method removes the characters in a substring of this StringBuffer. The substring begins at the specified start and extends to the character at index end - 1 or to the end of the StringBuffer if no such character exists.

If start is equal to end, no changes are made.

Syntax

Here is the syntax of this method −

public StringBuffer delete(int start, int end)

Parameters

Here is the detail of parameters −

  • start − The beginning index, inclusive.

  • end − The ending index, exclusive.

Return Value

  • This method returns the StringBuffer object.

Example

public class Test {

   public static void main(String args[]) {
      StringBuffer sb = new StringBuffer("abcdefghijk");
      sb.delete(3, 7); 
      System.out.println(sb); 
   }  
}

This will produce the following result −

Output

abchijk
java_strings.htm
Advertisements
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy