by Dinesh Thakur

StringBuffer delete (int start, int end): This method is used to remove a sequence of characters from the StringBuffer object. The start represents the index of the first character to be deleted and end represents the index of one past the last character to remove. Therefore, the deleted substring runs from start to end -1. For example,

StringBuffer s1 = new StringBuffer("Mr Dinesh Thakur ") :


results in deleting the substring starting from index 2 to 9 from this string buffer. The string buffer will now contain only "Mr Thakur".

public class StringBufferDelete

          public static void main(String[] args)
             StringBuffer s1 = new StringBuffer("Mr Dinesh Thakur");
             System.out.println("sl : " + s1);

StringBuffer delete() Method in Java Example