Tutorials Point


  Java Basics
  Java Object Oriented
  Java Advanced
  Java Useful References
  Java Useful Resources
  Selected Reading

© 2011 TutorialsPoint.COM


  Home     References     Discussion Forums     About TP  

Java - String Buffer delete() Method


previous next AddThis Social Bookmark Button


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 :

  • StringBuffer object.

Example:

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

This produces following result:

abchijk


previous next Printer Friendly



  

Advertisement

Online Image Processing

Indian Baby Names