stringbuffer.html

来自「j2se5-api-zh,java文档的中文版本」· HTML 代码 · 共 1,470 行 · 第 1/5 页

HTML
1,470
字号
public int <B>codePointAt</B>(int&nbsp;index)</PRE><DL><DD>Returns the character (Unicode code point) at the specified index. The index refers to <code>char</code> values (Unicode code units) and ranges from <code>0</code> to <A HREF="StringBuffer.html#length()"><CODE>length()</CODE></A><code> - 1</code>. <p> If the <code>char</code> value specified at the given index is in the high-surrogate range, the following index is less than the length of this sequence, and the <code>char</code> value at the following index is in the low-surrogate range, then the supplementary code point corresponding to this surrogate pair is returned. Otherwise, the <code>char</code> value at the given index is returned.<P><DD><DL></DL></DD><DD><DL><DT><B>参数:</B><DD><CODE>index</CODE> - the index to the <code>char</code> values<DT><B>返回:</B><DD>the code point value of the character at the             <code>index</code><DT><B>从以下版本开始:</B></DT>  <DD>1.5</DD></DL></DD></DL><HR><A NAME="codePointBefore(int)"><!-- --></A><H3>codePointBefore</H3><PRE>public int <B>codePointBefore</B>(int&nbsp;index)</PRE><DL><DD>Returns the character (Unicode code point) before the specified index. The index refers to <code>char</code> values (Unicode code units) and ranges from <code>1</code> to <A HREF="StringBuffer.html#length()"><CODE>length()</CODE></A>. <p> If the <code>char</code> value at <code>(index - 1)</code> is in the low-surrogate range, <code>(index - 2)</code> is not negative, and the <code>char</code> value at <code>(index - 2)</code> is in the high-surrogate range, then the supplementary code point value of the surrogate pair is returned. If the <code>char</code> value at <code>index - 1</code> is an unpaired low-surrogate or a high-surrogate, the surrogate value is returned.<P><DD><DL></DL></DD><DD><DL><DT><B>参数:</B><DD><CODE>index</CODE> - the index following the code point that should be returned<DT><B>返回:</B><DD>the Unicode code point value before the given index.<DT><B>从以下版本开始:</B></DT>  <DD>1.5</DD></DL></DD></DL><HR><A NAME="codePointCount(int, int)"><!-- --></A><H3>codePointCount</H3><PRE>public int <B>codePointCount</B>(int&nbsp;beginIndex,                          int&nbsp;endIndex)</PRE><DL><DD>Returns the number of Unicode code points in the specified text range of this sequence. The text range begins at the specified <code>beginIndex</code> and extends to the <code>char</code> at index <code>endIndex - 1</code>. Thus the length (in <code>char</code>s) of the text range is <code>endIndex-beginIndex</code>. Unpaired surrogates within this sequence count as one code point each.<P><DD><DL></DL></DD><DD><DL><DT><B>参数:</B><DD><CODE>beginIndex</CODE> - the index to the first <code>char</code> of the text range.<DD><CODE>endIndex</CODE> - the index after the last <code>char</code> of the text range.<DT><B>返回:</B><DD>the number of Unicode code points in the specified text range<DT><B>从以下版本开始:</B></DT>  <DD>1.5</DD></DL></DD></DL><HR><A NAME="offsetByCodePoints(int, int)"><!-- --></A><H3>offsetByCodePoints</H3><PRE>public int <B>offsetByCodePoints</B>(int&nbsp;index,                              int&nbsp;codePointOffset)</PRE><DL><DD>Returns the index within this sequence that is offset from the given <code>index</code> by <code>codePointOffset</code> code points. Unpaired surrogates within the text range given by <code>index</code> and <code>codePointOffset</code> count as one code point each.<P><DD><DL></DL></DD><DD><DL><DT><B>参数:</B><DD><CODE>index</CODE> - the index to be offset<DD><CODE>codePointOffset</CODE> - the offset in code points<DT><B>返回:</B><DD>the index within this sequence<DT><B>从以下版本开始:</B></DT>  <DD>1.5</DD></DL></DD></DL><HR><A NAME="getChars(int, int, char[], int)"><!-- --></A><H3>getChars</H3><PRE>public void <B>getChars</B>(int&nbsp;srcBegin,                     int&nbsp;srcEnd,                     char[]&nbsp;dst,                     int&nbsp;dstBegin)</PRE><DL><DD>Characters are copied from this sequence into the  destination character array <code>dst</code>. The first character to  be copied is at index <code>srcBegin</code>; the last character to  be copied is at index <code>srcEnd-1</code>. The total number of  characters to be copied is <code>srcEnd-srcBegin</code>. The  characters are copied into the subarray of <code>dst</code> starting  at index <code>dstBegin</code> and ending at index: <p><blockquote><pre> dstbegin + (srcEnd-srcBegin) - 1 </pre></blockquote><P><DD><DL></DL></DD><DD><DL><DT><B>参数:</B><DD><CODE>srcBegin</CODE> - start copying at this offset.<DD><CODE>srcEnd</CODE> - stop copying at this offset.<DD><CODE>dst</CODE> - the array to copy the data into.<DD><CODE>dstBegin</CODE> - offset into <code>dst</code>.<DT><B>抛出:</B><DD><CODE><A HREF="NullPointerException.html" title="java.lang 中的类">NullPointerException</A></CODE> - if <code>dst</code> is              <code>null</code>.<DD><CODE><A HREF="IndexOutOfBoundsException.html" title="java.lang 中的类">IndexOutOfBoundsException</A></CODE> - if any of the following is true:             <ul>             <li><code>srcBegin</code> is negative             <li><code>dstBegin</code> is negative             <li>the <code>srcBegin</code> argument is greater than              the <code>srcEnd</code> argument.             <li><code>srcEnd</code> is greater than              <code>this.length()</code>.             <li><code>dstBegin+srcEnd-srcBegin</code> is greater than              <code>dst.length</code>             </ul></DL></DD></DL><HR><A NAME="setCharAt(int, char)"><!-- --></A><H3>setCharAt</H3><PRE>public void <B>setCharAt</B>(int&nbsp;index,                      char&nbsp;ch)</PRE><DL><DD>The character at the specified index is set to <code>ch</code>. This  sequence is altered to represent a new character sequence that is  identical to the old character sequence, except that it contains the  character <code>ch</code> at position <code>index</code>.  <p> The index argument must be greater than or equal to  <code>0</code>, and less than the length of this sequence.<P><DD><DL></DL></DD><DD><DL><DT><B>参数:</B><DD><CODE>index</CODE> - the index of the character to modify.<DD><CODE>ch</CODE> - the new character.<DT><B>抛出:</B><DD><CODE><A HREF="IndexOutOfBoundsException.html" title="java.lang 中的类">IndexOutOfBoundsException</A></CODE> - if <code>index</code> is              negative or greater than or equal to <code>length()</code>.<DT><B>另请参见:</B><DD><A HREF="StringBuffer.html#length()"><CODE>length()</CODE></A></DL></DD></DL><HR><A NAME="append(java.lang.Object)"><!-- --></A><H3>append</H3><PRE>public <A HREF="StringBuffer.html" title="java.lang 中的类">StringBuffer</A> <B>append</B>(<A HREF="Object.html" title="java.lang 中的类">Object</A>&nbsp;obj)</PRE><DL><DD>Appends the string representation of the <code>Object</code>  argument. <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 sequence.<P><DD><DL></DL></DD><DD><DL><DT><B>参数:</B><DD><CODE>obj</CODE> - an <code>Object</code>.<DT><B>返回:</B><DD>a reference to this object.<DT><B>另请参见:</B><DD><A HREF="String.html#valueOf(java.lang.Object)"><CODE>String.valueOf(java.lang.Object)</CODE></A>, <A HREF="StringBuffer.html#append(java.lang.String)"><CODE>append(java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="append(java.lang.String)"><!-- --></A><H3>append</H3><PRE>public <A HREF="StringBuffer.html" title="java.lang 中的类">StringBuffer</A> <B>append</B>(<A HREF="String.html" title="java.lang 中的类">String</A>&nbsp;str)</PRE><DL><DD>Appends the specified string to this character sequence. <p> The characters of the <code>String</code> argument are appended, in  order, increasing the length of this sequence by the length of the  argument. If <code>str</code> is <code>null</code>, then the four  characters <code>"null"</code> are appended. <p> Let <i>n</i> be the length of this character sequence just prior to  execution of the <code>append</code> method. Then the character at  index <i>k</i> in the new character sequence is equal to the character  at index <i>k</i> in the old character sequence, if <i>k</i> is less  than <i>n</i>; otherwise, it is equal to the character at index  <i>k-n</i> in the argument <code>str</code>.<P><DD><DL></DL></DD><DD><DL><DT><B>参数:</B><DD><CODE>str</CODE> - a string.<DT><B>返回:</B><DD>a reference to this object.</DL></DD></DL><HR><A NAME="append(java.lang.StringBuffer)"><!-- --></A><H3>append</H3><PRE>public <A HREF="StringBuffer.html" title="java.lang 中的类">StringBuffer</A> <B>append</B>(<A HREF="StringBuffer.html" title="java.lang 中的类">StringBuffer</A>&nbsp;sb)</PRE><DL><DD>将指定的 <tt>StringBuffer</tt> 追加到此序列中。 <p>按顺序将 <tt>StringBuffer</tt> 参数中的字符追加到此 <tt>StringBuffer</tt> 中,并使 <tt>StringBuffer</tt> 在长度上增加该参数的长度。如果 <tt>sb</tt> 为 <tt>null</tt>,则将 4 个 <tt>&quot;null&quot;</tt> 字符追加到此 <tt>StringBuffer</tt> 中。 <p>在执行 <tt>append</tt> 方法前,让 <tt>StringBuffer</tt> 中包含的原有字符序列的长度为 <i>n</i>。如果 <i>k</i> 小于 <i>n</i>,则新字符序列中索引 <i>k</i> 处的字符等于原有字符序列中索引 <i>k</i> 处的字符;否则它等于参数 <code>sb</code> 中索引 <i>k-n</i> 处的字符。 <p>该方法在 <code>this</code>(目标)对象上实现同步,但不在源上(<code>sb</code>)实现同步。<P><DD><DL></DL></DD><DD><DL><DT><B>参数:</B><DD><CODE>sb</CODE> - 要追加的 <tt>StringBuffer</tt>。<DT><B>返回:</B><DD>该对象的一个引用。<DT><B>从以下版本开始:</B></DT>  <DD>1.4</DD></DL></DD></DL><HR><A NAME="append(java.lang.CharSequence)"><!-- --></A><H3>append</H3><PRE>public <A HREF="StringBuffer.html" title="java.lang 中的类">StringBuffer</A> <B>append</B>(<A HREF="CharSequence.html" title="java.lang 中的接口">CharSequence</A>&nbsp;s)</PRE><DL><DD>将指定的 <code>CharSequence</code> 追加到该序列。 <p>按顺序将 <code>CharSequence</code> 参数中的字符追加到该序列中,使该序列增加该参数的长度。<p>该方法的结果与调用 this.append(s, 0, s.length()) 完全相同; <p>该方法在 this(目标)对象上实现同步,但不在源上(<code>s</code>)实现同步。<p>如果 <code>s</code> 为 <code>null</code>,则追加 4 个 <code>&quot;null&quot;</code> 字符。<P><DD><DL><DT><B>指定者:</B><DD>接口 <CODE><A HREF="Appendable.html" title="java.lang 中的接口">Appendable</A></CODE> 中的 <CODE><A HREF="Appendable.html#append(java.lang.CharSequence)">append</A></CODE></DL></DD><DD><DL><DT><B>参数:</B><DD><CODE>s</CODE> - 要追加的 <code>CharSequence</code>。<DT><B>返回:</B><DD>此对象的一个引用。<DT><B>从以下版本开始:</B></DT>  <DD>1.5</DD></DL></DD></DL><HR><A NAME="append(java.lang.CharSequence, int, int)"><!-- --></A><H3>append</H3><PRE>public <A HREF="StringBuffer.html" title="java.lang 中的类">StringBuffer</A> <B>append</B>(<A HREF="CharSequence.html" title="java.lang 中的接口">CharSequence</A>&nbsp;s,                           int&nbsp;start,                           int&nbsp;end)</PRE><DL><DD>Appends a subsequence of the specified <code>CharSequence</code> to this sequence. <p> Characters of the argument <code>s</code>, starting at

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?