Share via


StringBuffer.insert

Class Overview | Class Members | This Package | All Packages

Syntax 1

public synchronized StringBuffer insert( int offset**, Object** obj )

Parameters
  • offset
    the offset.
  • b
    an Object.
Returns

this string buffer.

Description

Inserts the string representation of the Object argument into this string buffer.

The second argument is converted to a string as if by the method String.valueOf, and the characters of that string are then inserted into this string buffer at the indicated offset.

The offset argument must be greater than or equal to 0, and less than or equal to the length of this string buffer.

Exceptions

StringIndexOutOfBoundsException if the offset is invalid.

See Also

valueOf, insert, length

Syntax 2

public synchronized StringBuffer insert( int offset**, String** str )

Parameters
  • offset
    the offset.
  • str
    a string.
Returns

this string buffer.

Description

Inserts the string into this string buffer.

The characters of the String argument are inserted, in order, into this string buffer at the indicated offset. The length of this string buffer is increased by the length of the argument.

The offset argument must be greater than or equal to 0, and less than or equal to the length of this string buffer.

Exceptions

StringIndexOutOfBoundsException if the offset is invalid.

See Also

length

Syntax 3

public synchronized StringBuffer insert( int offset**, char** str[] )

Parameters
  • offset
    the offset.
  • ch
    a character array.
Returns

this string buffer.

Description

Inserts the string representation of the char array argument into this string buffer.

The characters of the array argument are inserted into the contents of this string buffer at the position indicated by offset. The length of this string buffer increases by the length of the argument.

Exceptions

StringIndexOutOfBoundsException if the offset is invalid.

Syntax 4

public StringBuffer insert( int offset**, boolean** b )

Parameters
  • offset
    the offset.
  • b
    a boolean.
Returns

this string buffer.

Description

Inserts the string representation of the boolean argument into this string buffer.

The second argument is converted to a string as if by the method String.valueOf, and the characters of that string are then inserted into this string buffer at the indicated offset.

The offset argument must be greater than or equal to 0, and less than or equal to the length of this string buffer.

Exceptions

StringIndexOutOfBoundsException if the offset is invalid.

See Also

valueOf, insert, length

Syntax 5

public synchronized StringBuffer insert( int offset**, char** c )

Parameters
  • offset
    the offset.
  • ch
    a char.
Returns

this string buffer.

Description

Inserts the string representation of the char argument into this string buffer.

The second argument is inserted into the contents of this string buffer at the position indicated by offset. The length of this string buffer increases by one.

The offset argument must be greater than or equal to 0, and less than or equal to the length of this string buffer.

Exceptions

StringIndexOutOfBoundsException if the offset is invalid.

See Also

length

Syntax 6

public StringBuffer insert( int offset**, int** i )

Parameters
  • offset
    the offset.
  • b
    an int.
Returns

this string buffer.

Description

Inserts the string representation of the second int argument into this string buffer.

The second argument is converted to a string as if by the method String.valueOf, and the characters of that string are then inserted into this string buffer at the indicated offset.

The offset argument must be greater than or equal to 0, and less than or equal to the length of this string buffer.

Exceptions

StringIndexOutOfBoundsException if the offset is invalid.

See Also

valueOf, insert, length

Syntax 7

public StringBuffer insert( int offset**, long** l )

Parameters
  • offset
    the offset.
  • b
    a long.
Returns

this string buffer.

Description

Inserts the string representation of the long argument into this string buffer.

The second argument is converted to a string as if by the method String.valueOf, and the characters of that string are then inserted into this string buffer at the indicated offset.

The offset argument must be greater than or equal to 0, and less than or equal to the length of this string buffer.

Exceptions

StringIndexOutOfBoundsException if the offset is invalid.

See Also

valueOf, insert, length

Syntax 8

public StringBuffer insert( int offset**, float** f )

Parameters
  • offset
    the offset.
  • b
    a float.
Returns

this string buffer.

Description

Inserts the string representation of the float argument into this string buffer.

The second argument is converted to a string as if by the method String.valueOf, and the characters of that string are then inserted into this string buffer at the indicated offset.

The offset argument must be greater than or equal to 0, and less than or equal to the length of this string buffer.

Exceptions

StringIndexOutOfBoundsException if the offset is invalid.

See Also

valueOf, insert, length

Syntax 9

public StringBuffer insert( int offset**, double** d )

Parameters
  • offset
    the offset.
  • b
    a double.
Returns

this string buffer.

Description

Inserts the string representation of the double argument into this string buffer.

The second argument is converted to a string as if by the method String.valueOf, and the characters of that string are then inserted into this string buffer at the indicated offset.

The offset argument must be greater than or equal to 0, and less than or equal to the length of this string buffer.

Exceptions

StringIndexOutOfBoundsException if the offset is invalid.

See Also

valueOf, insert, length