⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 javalang.doc12.html

📁 java语言规范
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<p>
<a name="5298"></a>
The argument is converted to a string as if by the method <code>String.valueOf</code> 
<a href="javalang.doc11.html#14023">(&#167;20.12.44)</a> and the characters of that string are then appended <a href="javalang.doc12.html#14040">(&#167;20.13.13)</a> to this 
<code>StringBuffer</code> object. A reference to this <code>StringBuffer</code> object is returned.
<p><a name="14047"></a>
<p><font size=+1><strong>20.13.20   </strong> <code>public StringBuffer <code><b>append</b></code>(float f)</code></font>
<p>
<a name="5308"></a>
The argument is converted to a string as if by the method <code>String.valueOf</code> 
<a href="javalang.doc11.html#14024">(&#167;20.12.45)</a> and the characters of that string are then appended <a href="javalang.doc12.html#14040">(&#167;20.13.13)</a> to this 
<code>StringBuffer</code> object. A reference to this <code>StringBuffer</code> object is returned.
<p><a name="14048"></a>
<p><font size=+1><strong>20.13.21   </strong> <code>public StringBuffer <code><b>append</b></code>(double d)</code></font>
<p>
<a name="5318"></a>
The argument is converted to a string as if by the method <code>String.valueOf</code> 
<a href="javalang.doc11.html#14025">(&#167;20.12.46)</a> and the characters of that string are then appended <a href="javalang.doc12.html#14040">(&#167;20.13.13)</a> to this 
<code>StringBuffer</code> object. A reference to this <code>StringBuffer</code> object is returned.
<p><a name="5192"></a>
<p><font size=+1><strong>20.13.22   </strong> <code>public StringBuffer <code><b>insert</b></code>(int offset, Object obj)<br>	throws <code>IndexOutOfBoundsException</code></code></font>
<p>
<a name="5444"></a>
The argument is converted to a string as if by the method <code>String.valueOf</code> 
<a href="javalang.doc11.html#14015">(&#167;20.12.38)</a> and the characters of that string are then inserted <a href="javalang.doc12.html#14050">(&#167;20.13.23)</a> into this 
<code>StringBuffer</code> object at the position indicated by <code>offset</code>. A reference to this 
<code>StringBuffer</code> object is returned.
<p><a name="14050"></a>
<p><font size=+1><strong>20.13.23   </strong> <code>public StringBuffer <code><b>insert</b></code>(int offset, String str)<br>	throws <code>IndexOutOfBoundsException</code></code></font>
<p>
<a name="5548"></a>
The characters of the <code>String</code> argument are inserted, in order, into the string buffer 
at the position indicated by <code>offset</code>, moving up any characters originally above 
that position and increasing the length of the string buffer by the length of the 
argument. If <code>str</code> is <code>null</code>, then the four characters "<code>null</code>" are inserted into this 
string buffer. The method <code>ensureCapacity</code> <a href="javalang.doc12.html#14034">(&#167;20.13.7)</a> is first called with this new 
string buffer length as its argument. A reference to this <code>StringBuffer</code> object is 
returned.
<p><a name="5552"></a>
The character at index <i>k</i> in the new character sequence is equal to:<p>
<ul><a name="5626"></a>
<li>the character at index <i>k</i> in the old character sequence, if <i>k</i> is less than <code>offset</code>
<a name="5631"></a>
<li>the character at index <i>k</i><code>-offset</code> in the argument <code>str</code>, if <i>k</i> is not less than <code>offset</code> &#32;but is less than <code>offset+str.length()</code>
<a name="5636"></a>
<li>the character at index <i>k</i><code>-str.length()</code> in the old character sequence, if <i>k</i> is not less than <code>offset+str.length()</code>
</ul><a name="14051"></a>
<p><font size=+1><strong>20.13.24   </strong> <code>public StringBuffer <code><b>insert</b></code>(int offset, char[] str) <br>throws NullPointerException,<br> &#32; &#32; &#32;<code>IndexOutOfBoundsException</code></code></font>
<p>
<a name="5556"></a>
The characters of the array argument, taken in order, are inserted into this string 
buffer, increasing the length of the string buffer by the length of the argument. The 
method <code>ensureCapacity</code> <a href="javalang.doc12.html#14034">(&#167;20.13.7)</a> is first called with this new string buffer 
length as its argument. A reference to this <code>StringBuffer</code> object is returned.
<p><a name="7135"></a>
The overall effect is exactly as if the argument were converted to a string by the method <code>String.valueOf</code> <a href="javalang.doc11.html#4778">(&#167;20.12.39)</a> and the characters of that string were then inserted <a href="javalang.doc12.html#14050">(&#167;20.13.23)</a> into this <code>StringBuffer</code> object at the position indicated by <code>offset</code>.<p>
<a name="5568"></a>
Note that while the <code>StringBuffer</code> class provides an <code>append</code> method that takes an offset, a character array, and two other arguments <a href="javalang.doc12.html#14042">(&#167;20.13.15)</a>, it does not currently provide an <code>insert</code> method that takes an offset, a character array, and two other arguments.<p>
<a name="14052"></a>
<p><font size=+1><strong>20.13.25   </strong> <code>public StringBuffer <code><b>insert</b></code>(int offset, boolean b)<br>	throws <code>IndexOutOfBoundsException</code></code></font>
<p>
<a name="5457"></a>
The argument is converted to a string as if by the method <code>String.valueOf</code> 
<a href="javalang.doc11.html#14020">(&#167;20.12.41)</a> and the characters of that string are then inserted <a href="javalang.doc12.html#14050">(&#167;20.13.23)</a> into this 
<code>StringBuffer</code> object at the position indicated by <code>offset</code>. A reference to this 
<code>StringBuffer</code> object is returned.
<p><a name="14053"></a>
<p><font size=+1><strong>20.13.26   </strong> <code>public StringBuffer <code><b>insert</b></code>(int offset, char c)<br>	throws <code>IndexOutOfBoundsException</code></code></font>
<p>
<a name="5464"></a>
The argument is inserted into the contents of this string buffer at the position indicated
by <code>offset</code>, increasing the length of this string buffer by <code>1</code>. The method 
<code>ensureCapacity</code> <a href="javalang.doc12.html#14034">(&#167;20.13.7)</a> is first called with this new string buffer length as its 
argument. A reference to this <code>StringBuffer</code> object is returned.
<p><a name="7145"></a>
The overall effect is exactly as if the argument were converted to a string by the method <code>String.valueOf</code> <a href="javalang.doc11.html#14021">(&#167;20.12.42)</a> and the character in that string were then inserted <a href="javalang.doc12.html#14050">(&#167;20.13.23)</a> into this <code>StringBuffer</code> object at the position indicated by <code>offset</code>.<p>
<a name="14054"></a>
<p><font size=+1><strong>20.13.27   </strong> <code>public StringBuffer <code><b>insert</b></code>(int offset, int i)<br>	throws <code>IndexOutOfBoundsException</code></code></font>
<p>
<a name="5480"></a>
The argument is converted to a string as if by the method <code>String.valueOf</code> 
<a href="javalang.doc11.html#14022">(&#167;20.12.43)</a> and the characters of that string are then inserted <a href="javalang.doc12.html#14050">(&#167;20.13.23)</a> into this 
<code>StringBuffer</code> object at the position indicated by <code>offset</code>. A reference to this 
<code>StringBuffer</code> object is returned.
<p><a name="14055"></a>
<p><font size=+1><strong>20.13.28   </strong> <code>public StringBuffer <code><b>insert</b></code>(int offset, long l)<br>	throws <code>IndexOutOfBoundsException</code></code></font>
<p>
<a name="5499"></a>
The argument is converted to a string as if by the method <code>String.valueOf</code> 
<a href="javalang.doc11.html#14023">(&#167;20.12.44)</a> and the characters of that string are inserted <a href="javalang.doc12.html#14050">(&#167;20.13.23)</a> into this 
<code>StringBuffer</code> object at the position indicated by <code>offset</code>. A reference to this 
<code>StringBuffer</code> object is returned.
<p><a name="14056"></a>
<p><font size=+1><strong>20.13.29   </strong> <code>public StringBuffer <code><b>insert</b></code>(int offset, float f)<br>	throws <code>IndexOutOfBoundsException</code></code></font>
<p>
<a name="5509"></a>
The argument is converted to a string as if by the method <code>String.valueOf</code> 
<a href="javalang.doc11.html#14024">(&#167;20.12.45)</a> and the characters of that string are then inserted <a href="javalang.doc12.html#14050">(&#167;20.13.23)</a> into this 
<code>StringBuffer</code> object at the position indicated by <code>offset</code>. A reference to this 
<code>StringBuffer</code> object is returned.
<p><a name="14057"></a>
<p><font size=+1><strong>20.13.30   </strong> <code>public StringBuffer <code><b>insert</b></code>(int offset, double d)<br>	throws <code>IndexOutOfBoundsException</code></code></font>
<p>
<a name="5520"></a>
The argument is converted to a string as if by the method <code>String.valueOf</code> 
<a href="javalang.doc11.html#14025">(&#167;20.12.46)</a> and the characters of that string are then inserted <a href="javalang.doc12.html#14050">(&#167;20.13.23)</a> into this 
<code>StringBuffer</code> object at the position indicated by <code>offset</code>. A reference to this 
<code>StringBuffer</code> object is returned.
<p><a name="7079"></a>
<p><font size=+1><strong>20.13.31   </strong> <code>public StringBuffer <code><b>reverse</b></code>()</code></font>
<p>
<a name="7162"></a>
The character sequence contained in this <code>StringBuffer</code> object is replaced by the 
reverse of that sequence. A reference to this <code>StringBuffer</code> object is returned.
<p><a name="7168"></a>
Let <i>n</i> be the length of the old character sequence, the one contained in the string buffer just prior to execution of the <code>reverse</code> method. Then the character at index <i>k</i> in the new character sequence is equal to the character at index <i>n</i><code>-</code><i>k</i><code>-1</code> in the old character sequence.<p>


<hr>
<!-- This inserts footnotes--><p>
<a href="index.html">Contents</a> | <a href="javalang.doc11.html">Prev</a> | <a href="javalang.doc13.html">Next</a> | <a href="j.index.doc1.html">Index</a>
<p>
<font size=-1>Java Language Specification (HTML generated by Suzette Pelouch on February 24, 1998)<br>
<i><a href="jcopyright.doc.html">Copyright &#169 1996 Sun Microsystems, Inc.</a>
All rights reserved</i>
<br>
Please send any comments or corrections to <a href="mailto:doug.kramer@sun.com">doug.kramer@sun.com</a>
</font>
</body></html>

⌨️ 快捷键说明

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