THE PACKAGE JAVA.LANG
java.lang.StringBuffer
20.13
20.13.22
public StringBuffer insert(int offset, Object obj)
throws IndexOutOfBoundsException
The argument is converted to a string as if by the method
String.valueOf
( 20.12.38) and the characters of that string are then inserted ( 20.13.23) into this
StringBuffer
object at the position indicated by
offset
. A reference to this
StringBuffer
object is returned.
20.13.23
public StringBuffer insert(int offset, String str)
throws IndexOutOfBoundsException
The characters of the
String
argument are inserted, in order, into the string buffer
at the position indicated by
offset
, moving up any characters originally above
that position and increasing the length of the string buffer by the length of the
argument. If
str
is
null
, then the four characters
null
are inserted into this
string buffer. The method
ensureCapacity
( 20.13.7) is first called with this new
string buffer length as its argument. A reference to this
StringBuffer
object is
returned.
The character at index
k
in the new character sequence is equal to:
the character at index
k
in the old character sequence, if
k
is less than
offset
the character at index
k offset
in the argument
str
, if
k
is not less than
offset
but is less than
offset+str.length()
the character at index
k str.length()
in the old character sequence, if
k
is
not less than
offset+str.length()
20.13.24
public StringBuffer insert(int offset, char[] str)
throws NullPointerException,
IndexOutOfBoundsException
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
ensureCapacity
( 20.13.7) is first called with this new string buffer
length as its argument. A reference to this
StringBuffer
object is returned.
The overall effect is exactly as if the argument were converted to a string by
the method
String.valueOf
( 20.12.39) and the characters of that string were
then inserted ( 20.13.23) into this
StringBuffer
object at the position indicated
by
offset
.
555
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved