Java Stringbuffer.delete () method __java

Source: Internet
Author: User
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=" &amp;aurl=&amp;cad=1&amp;ccd=24&amp;cec=utf-8&amp;cfv=17&amp;ch=0&amp;col=zh-cn &amp;conop=0&amp;cpa=1&amp;dai=1&amp;dis=0&amp;ltr=https%3a%2f%2fwww.baidu.com%2flink% 3furl%3d8vsmdnayjftb1tfegdtz4spxp1u5izk13rub_51gji5m5ohdz8zyghv-6zwe2jril3j0srjh8l8df_jfd8_smuggyyre_ mqzdn7ewlvnnwk%26wd%3d%26eqid%3de351f3aa0005e2b700000005555da349%26ie%3dutf-8&amp;ltu=http%3a%2f% 2fwww.yiibai.com%2fjavalang%2fstringbuffer_delete.html&amp;lunum=6&amp;n=90029059_cpr&amp;pcs= 900x505&amp;pis=10000x10000&amp;ps=394x297&amp;psr=1440x900&amp;pss=1080x1472&amp;qn= bc0a5c602e353ef9&amp;rad=&amp;rsi0=728&amp;rsi1=90&amp;rsi5=4&amp;rss0=%23ffffff&amp; Rss1=%23ffffff&amp;rss2=%230000ff&amp;rss3=%23444444&amp;rss4=%23008000&amp;rss5=&amp;rss6=%23e10900&amp;rss7= &amp;scale=&amp;skin=&amp;td_id=1064372&amp;tn=text_default_728_90&amp;tpr=1432200013616 &amp;ts=1&amp;version=2.0&amp;xuanting=0&amp;dtm=baidu_dup2_setjsonadslot&amp;dc=2&amp ;d i=u1064372&amp;ti=java%20stringbuffer.delete ()%e6%96%b9%e6%b3%95&amp;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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.