Java StringBuffer deleteCharAt Example
StringBuffer class deleteCharAt method example. This example shows you how to use deleteCharAt method.
StringBuffer class deleteCharAt method example. This example shows you how to use deleteCharAt method.
public StringBuffer deleteCharAt(int index)
Removes the char at the specified position in this sequence. This sequence is shortened by one char.
Here is the full cade:
/**
* @(#) DeleteCharAt. java
* A class representing deleteCharAt method
* @Version 01-May-2008
* @author Rose India Team
*/
public class DeleteCharAt {
public static void main(String args[]) {
StringBuffer sb = new StringBuffer("Rose India");
//Removes the character at index 0 in the StringBuffer.
sb.deleteCharAt(0);
System.out.println("After deleteCharAt: " + sb);
//Removes the character at index 4 in the StringBuffer.
sb.deleteCharAt(4);
System.out.println("After deleteCharAt: " + sb);
}
} |
null
|