insert

open fun insert(index: Int, @NonNull str: Array<Char>, offset: Int, len: Int): Text.Builder

Inserts the string representation of a subarray of the str array argument into this sequence. The subarray begins at the specified offset and extends lenchars. The characters of the subarray are inserted into this sequence at the position indicated by index. The length of this sequence increases by lenchars.

Return

This object

Parameters

index

position at which to insert subarray.

str

A char array.

offset

the index of the first char in subarray to be inserted.

len

the number of chars in the subarray to be inserted.

Throws

if index is negative or greater than length(), or offset or len are negative, or (offset+len) is greater than str.length.


open fun insert(offset: Int, @NonNull obj: Any): Text.Builder

Inserts the string representation of the Object argument into this character sequence.

The overall effect is exactly as if the second argument were converted to a string by the method valueOf, and the characters of that string were then inserted into this character sequence 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 sequence.

Return

a reference to this object.

Parameters

offset

the offset.

obj

an Object.

Throws

if the offset is invalid.


open fun insert(offset: Int, @NonNull fstring: String, @Nullable objs: Array<Any>): Text.Builder

Inserts the string representation of the Object argument into this character sequence after applying a format call.

The overall effect is exactly as if the string was formatted using format, passed into the insert method, and then inserted into this character sequence 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 sequence.

Return

a reference to this object.

Parameters

offset

the offset.

fstring

the format string.

objs

the objects to insert into the string.

Throws

if the offset is invalid.