insertRange

JVM
1.3
@ExperimentalStdlibApi fun StringBuilder.insertRange(
    index: Int,
    value: CharArray,
    startIndex: Int,
    endIndex: Int
): StringBuilder

Inserts characters in a subarray of the specified character array value into this string builder at the specified index and returns this instance.

The inserted characters go in same order as in the value array, starting at index.

Parameters

index - the position in this string builder to insert at.

value - the array from which characters are inserted.

startIndex - the beginning (inclusive) of the subarray to insert.

endIndex - the end (exclusive) of the subarray to insert.

Exceptions

IndexOutOfBoundsException - or IllegalArgumentException when startIndex or endIndex is out of range of the value array indices or when startIndex > endIndex.

IndexOutOfBoundsException - if index is less than zero or greater than the length of this string builder.

JVM
1.3
@ExperimentalStdlibApi fun StringBuilder.insertRange(
    index: Int,
    value: CharSequence?,
    startIndex: Int,
    endIndex: Int
): StringBuilder

Inserts characters in a subsequence of the specified character sequence value into this string builder at the specified index and returns this instance.

The inserted characters go in the same order as in the value character sequence, starting at index.

Parameters

index - the position in this string builder to insert at.

value - the character sequence from which a subsequence is inserted. If value is null, then characters will be inserted as if value contained the four characters "null".

startIndex - the beginning (inclusive) of the subsequence to insert.

endIndex - the end (exclusive) of the subsequence to insert.

Exceptions

IndexOutOfBoundsException - or IllegalArgumentException when startIndex or endIndex is out of range of the value character sequence indices or when startIndex > endIndex.

IndexOutOfBoundsException - if index is less than zero or greater than the length of this string builder.