stringbuffer.html
来自「API資料大全」· HTML 代码 · 共 1,387 行 · 第 1/5 页
HTML
1,387 行
of this string buffer. The length of this string buffer increases by the value of <code>len</code>. <p> The overall effect is exactly as if the arguments were converted to a string by the method <A HREF="../../java/lang/String.html#valueOf(char[], int, int)"><CODE>String.valueOf(char[],int,int)</CODE></A> and the characters of that string were then <A HREF="../../java/lang/StringBuffer.html#append(java.lang.String)"><CODE>appended</CODE></A> to this <code>StringBuffer</code> object.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>str</CODE> - the characters to be appended.<DD><CODE>offset</CODE> - the index of the first character to append.<DD><CODE>len</CODE> - the number of characters to append.<DT><B>Returns:</B><DD>a reference to this <code>StringBuffer</code> object.</DL></DD></DL><HR><A NAME="append(boolean)"><!-- --></A><H3>append</H3><PRE>public <A HREF="../../java/lang/StringBuffer.html">StringBuffer</A> <B>append</B>(boolean b)</PRE><DL><DD>Appends the string representation of the <code>boolean</code> argument to the string buffer. <p> The argument is converted to a string as if by the method <code>String.valueOf</code>, and the characters of that string are then appended to this string buffer.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>b</CODE> - a <code>boolean</code>.<DT><B>Returns:</B><DD>a reference to this <code>StringBuffer</code>.<DT><B>See Also: </B><DD><A HREF="../../java/lang/String.html#valueOf(boolean)"><CODE>String.valueOf(boolean)</CODE></A>, <A HREF="../../java/lang/StringBuffer.html#append(java.lang.String)"><CODE>append(java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="append(char)"><!-- --></A><H3>append</H3><PRE>public <A HREF="../../java/lang/StringBuffer.html">StringBuffer</A> <B>append</B>(char c)</PRE><DL><DD>Appends the string representation of the <code>char</code> argument to this string buffer. <p> The argument is appended to the contents of this string buffer. The length of this string buffer increases by <code>1</code>. <p> The overall effect is exactly as if the argument were converted to a string by the method <A HREF="../../java/lang/String.html#valueOf(char)"><CODE>String.valueOf(char)</CODE></A> and the character in that string were then <A HREF="../../java/lang/StringBuffer.html#append(java.lang.String)"><CODE>appended</CODE></A> to this <code>StringBuffer</code> object.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>c</CODE> - a <code>char</code>.<DT><B>Returns:</B><DD>a reference to this <code>StringBuffer</code> object.</DL></DD></DL><HR><A NAME="append(int)"><!-- --></A><H3>append</H3><PRE>public <A HREF="../../java/lang/StringBuffer.html">StringBuffer</A> <B>append</B>(int i)</PRE><DL><DD>Appends the string representation of the <code>int</code> argument to this string buffer. <p> The argument is converted to a string as if by the method <code>String.valueOf</code>, and the characters of that string are then appended to this string buffer.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>i</CODE> - an <code>int</code>.<DT><B>Returns:</B><DD>a reference to this <code>StringBuffer</code> object.<DT><B>See Also: </B><DD><A HREF="../../java/lang/String.html#valueOf(int)"><CODE>String.valueOf(int)</CODE></A>, <A HREF="../../java/lang/StringBuffer.html#append(java.lang.String)"><CODE>append(java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="append(long)"><!-- --></A><H3>append</H3><PRE>public <A HREF="../../java/lang/StringBuffer.html">StringBuffer</A> <B>append</B>(long l)</PRE><DL><DD>Appends the string representation of the <code>long</code> argument to this string buffer. <p> The argument is converted to a string as if by the method <code>String.valueOf</code>, and the characters of that string are then appended to this string buffer.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>l</CODE> - a <code>long</code>.<DT><B>Returns:</B><DD>a referenct to this <code>StringBuffer</code> object.<DT><B>See Also: </B><DD><A HREF="../../java/lang/String.html#valueOf(long)"><CODE>String.valueOf(long)</CODE></A>, <A HREF="../../java/lang/StringBuffer.html#append(java.lang.String)"><CODE>append(java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="append(float)"><!-- --></A><H3>append</H3><PRE>public <A HREF="../../java/lang/StringBuffer.html">StringBuffer</A> <B>append</B>(float f)</PRE><DL><DD>Appends the string representation of the <code>float</code> argument to this string buffer. <p> The argument is converted to a string as if by the method <code>String.valueOf</code>, and the characters of that string are then appended to this string buffer.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>f</CODE> - a <code>float</code>.<DT><B>Returns:</B><DD>a reference to this <code>StringBuffer</code> object.<DT><B>See Also: </B><DD><A HREF="../../java/lang/String.html#valueOf(float)"><CODE>String.valueOf(float)</CODE></A>, <A HREF="../../java/lang/StringBuffer.html#append(java.lang.String)"><CODE>append(java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="append(double)"><!-- --></A><H3>append</H3><PRE>public <A HREF="../../java/lang/StringBuffer.html">StringBuffer</A> <B>append</B>(double d)</PRE><DL><DD>Appends the string representation of the <code>double</code> argument to this string buffer. <p> The argument is converted to a string as if by the method <code>String.valueOf</code>, and the characters of that string are then appended to this string buffer.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>d</CODE> - a <code>double</code>.<DT><B>Returns:</B><DD>a reference to this <code>StringBuffer</code> object.<DT><B>See Also: </B><DD><A HREF="../../java/lang/String.html#valueOf(double)"><CODE>String.valueOf(double)</CODE></A>, <A HREF="../../java/lang/StringBuffer.html#append(java.lang.String)"><CODE>append(java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="delete(int, int)"><!-- --></A><H3>delete</H3><PRE>public <A HREF="../../java/lang/StringBuffer.html">StringBuffer</A> <B>delete</B>(int start, int end)</PRE><DL><DD>Removes the characters in a substring of this <code>StringBuffer</code>. The substring begins at the specified <code>start</code> and extends to the character at index <code>end - 1</code> or to the end of the <code>StringBuffer</code> if no such character exists. If <code>start</code> is equal to <code>end</code>, no changes are made.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>start</CODE> - The beginning index, inclusive.<DD><CODE>end</CODE> - The ending index, exclusive.<DT><B>Returns:</B><DD>This string buffer.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/StringIndexOutOfBoundsException.html">StringIndexOutOfBoundsException</A></CODE> - if <code>start</code> is negative, greater than <code>length()</code>, or greater than <code>end</code>.<DT><B>Since: </B><DD>1.2</DD></DL></DD></DL><HR><A NAME="deleteCharAt(int)"><!-- --></A><H3>deleteCharAt</H3><PRE>public <A HREF="../../java/lang/StringBuffer.html">StringBuffer</A> <B>deleteCharAt</B>(int index)</PRE><DL><DD>Removes the character at the specified position in this <code>StringBuffer</code> (shortening the <code>StringBuffer</code> by one character).<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>index</CODE> - Index of character to remove<DT><B>Returns:</B><DD>This string buffer.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/StringIndexOutOfBoundsException.html">StringIndexOutOfBoundsException</A></CODE> - if the <code>index</code> is negative or greater than or equal to <code>length()</code>.<DT><B>Since: </B><DD>1.2</DD></DL></DD></DL><HR><A NAME="replace(int, int, java.lang.String)"><!-- --></A><H3>replace</H3><PRE>public <A HREF="../../java/lang/StringBuffer.html">StringBuffer</A> <B>replace</B>(int start, int end, <A HREF="../../java/lang/String.html">String</A> str)</PRE><DL><DD>Replaces the characters in a substring of this <code>StringBuffer</code> with characters in the specified <code>String</code>. The substring begins at the specified <code>start</code> and extends to the character at index <code>end - 1</code> or to the end of the <code>StringBuffer</code> if no such character exists. First the characters in the substring are removed and then the specified <code>String</code> is inserted at <code>start</code>. (The <code>StringBuffer</code> will be lengthened to accommodate the specified String if necessary.)<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>start</CODE> - The beginning index, inclusive.<DD><CODE>end</CODE> - The ending index, exclusive.<DD><CODE>str</CODE> - String that will replace previous contents.<DT><B>Returns:</B><DD>This string buffer.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/StringIndexOutOfBoundsException.html">StringIndexOutOfBoundsException</A></CODE> - if <code>start</code> is negative, greater than <code>length()</code>, or greater than <code>end</code>.<DT><B>Since: </B><DD>1.2</DD></DL></DD></DL><HR><A NAME="substring(int)"><!-- --></A><H3>substring</H3><PRE>public <A HREF="../../java/lang/String.html">String</A> <B>substring</B>(int start)</PRE><DL><DD>Returns a new <code>String</code> that contains a subsequence of characters currently contained in this <code>StringBuffer</code>.The substring begins at the specified index and extends to the end of the <code>StringBuffer</code>.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>start</CODE> - The beginning index, inclusive.<DT><B>Returns:</B><DD>The new string.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/StringIndexOutOfBoundsException.html">StringIndexOutOfBoundsException</A></CODE> - if <code>start</code> is less than zero, or greater than the length of this <code>StringBuffer</code>.<DT><B>Since: </B><DD>1.2</DD></DL></DD></DL><HR><A NAME="substring(int, int)"><!-- --></A><H3>substring</H3><PRE>public <A HREF="../../java/lang/String.html">String</A> <B>substring</B>(int start, int end)</PRE><DL><DD>Returns a new <code>String</code> that contains a subsequence of characters currently contained in this <code>StringBuffer</code>. The substring begins at the specified <code>start</code> and extends to the character at index <code>end - 1</code>. An exception is thrown if<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>start</CODE> - The beginning index, inclusive.<DD><CODE>end</CODE> - The ending index, exclusive.<DT><B>Returns:</B><DD>The new string.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/StringIndexOutOfBoundsException.html">StringIndexOutOfBoundsException</A></CODE> - if <code>start</code> or <code>end</code> are negative or greater than <code>length()</code>, or <code>start</code> is greater than <code>end</code>.<DT><B>Since: </B><DD>1.2</DD></DL></DD></DL><HR><A NAME="insert(int, char[], int, int)"><!-- --></A><H3>insert</H3><PRE>public <A HREF="../../java/lang/StringBuffer.html">StringBuffer</A> <B>insert</B>(int index, char[] str, int offset, int len)</PRE><DL><DD>Inserts the string representation of a subarray of the <code>str</code> array argument into this string buffer. The subarray begins at the specified <code>offset</code> and extends <code>len</code> characters. The characters of the subarray are inserted into this string buffer at the position indicated by <code>index</code>. The length of this <code>StringBuffer</code> increases by <code>len</code> characters.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>index</CODE> - position at which to insert subarray.<DD><CODE>str</CODE> - A character array.<DD><CODE>offset</CODE> - the index of the first character in subarray to to be inserted.<DD><CODE>len</CODE> - the number of characters in the subarray to to be inserted.<DT><B>Returns:</B><DD>This string buffer.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/StringIndexOutOfBoundsException.html">StringIndexOutOfBoundsException</A></CODE> - if <code>index</code> is negative or greater than <code>length()</code>, or <code>offset</code> or <code>len</code> are negative, or <code>(offset+len)</code> is greater than <code>str.length</code>.<DT><B>Since: </B><DD>1.2</DD></DL></DD></DL><HR>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?