copyOfRange

external fun <T> Array<T>.copyOfRange(fromIndex: Int, toIndex: Int): Array<T>(source)

Returns a new array containing elements from fromIndex up to, but excluding, toIndex.

Guest execution currently supports this overload only for Array<String>. The requested range must fit entirely inside the source; it is not padded.

Receiver

the array to copy from.

Return

a new array containing the selected range.

Parameters

fromIndex

the inclusive start of the range.

toIndex

the exclusive end of the range.

Type Parameters

T

the element type; currently only String is executable for this overload.

Throws

if the computed range length is negative.

if the source range is outside this array.