Java Stringbuffer.delete () method Java stringbuffer.delete () method usage tutorial, deletes characters from one substring of this sequence. The sequence at which the character index of a substring begins at the specified start and extension end-1 or ends, if no such character exists. If start equals end, no changes are made. <iframe id= "Cproiframe_u1064372_1" width= "728" height= "src=" &aurl=&cad=1&ccd=24&cec=utf-8&cfv=17&ch=0&col=zh-cn &conop=0&cpa=1&dai=1&dis=0&ltr=https%3a%2f%2fwww.baidu.com%2flink% 3furl%3d8vsmdnayjftb1tfegdtz4spxp1u5izk13rub_51gji5m5ohdz8zyghv-6zwe2jril3j0srjh8l8df_jfd8_smuggyyre_ mqzdn7ewlvnnwk%26wd%3d%26eqid%3de351f3aa0005e2b700000005555da349%26ie%3dutf-8&ltu=http%3a%2f% 2fwww.yiibai.com%2fjavalang%2fstringbuffer_delete.html&lunum=6&n=90029059_cpr&pcs= 900x505&pis=10000x10000&ps=394x297&psr=1440x900&pss=1080x1472&qn= bc0a5c602e353ef9&rad=&rsi0=728&rsi1=90&rsi5=4&rss0=%23ffffff& Rss1=%23ffffff&rss2=%230000ff&rss3=%23444444&rss4=%23008000&rss5=&rss6=%23e10900&rss7= &scale=&skin=&td_id=1064372&tn=text_default_728_90&tpr=1432200013616 &ts=1&version=2.0&xuanting=0&dtm=baidu_dup2_setjsonadslot&dc=2& ;d i=u1064372&ti=java%20stringbuffer.delete ()%e6%96%b9%e6%b3%95&tt=1432200013591.27.218.222 " Align= "Center,center" marginwidth= "0" marginheight= "0" scrolling= "no" frameborder= "0" allowtransparency= "true" style = "Box-sizing:border-box;" ></iframe>
Description
The Java.lang.StringBuffer.delete () method deletes the characters from a substring of this sequence. The sequence at which the character index of a substring begins at the specified start and extension end-1 or ends, if no such character exists. If start equals end, no changes are made. Statement
The following is a declaration of the Java.lang.StringBuffer.delete () method
Public StringBuffer Delete (int start, int end)
Parameters
Start--This is the beginning index, inclusive.
End--It is the ending index, exclusive. return value
This method returns this object exception
Stringindexoutofboundsexception--If start is negative, greater than length () or greater than end instance
The following example shows how to use the Java.lang.StringBuffer.delete () method
Package Com.yiibai;
Import java.lang.*;
public class Stringbufferdemo {public
static void Main (string[] args) {
StringBuffer buff = new StringBuffer ("Jav A lang package ");
System.out.println ("buffer =" + buff);
Deleting characters from index 4 to index 9
buff.delete (4, 9);
System.out.println ("After deletion =" + buff);
}
Let's compile and run the above program, which will produce the following results:
Buffer = Java lang package after
deletion = Java package