Java StringBuffer delete Example
StringBuffer class delete method example. This example shows you how to use delete method.
StringBuffer class delete method example. This example shows you how to use delete method.
public StringBuffer delete(int start,int end)
Removes the characters in a substring of this sequence. The substring begins at the specified start and extends to the character at index end - 1 or to the end of the sequence if no such character exists. If start is equal to end, no changes are made.
Here is the full code
/**
* @(#) DeleteString.java
* A class representing delete method
* @Version 01-May-2008
* @author Rose India Team
*/
public class DeleteString {
public static void main(String args[]) {
StringBuffer sb = new StringBuffer("Rose India Tech");
//Removes the characters at index 10 to 15 in the StringBuffer.
sb.delete(10, 15);
System.out.println("After delete: " + sb);
}
} |
null
|