copyOfRange

expect fun <T> Array<T>.copyOfRange(fromIndex: Int, toIndex: Int): Array<T>(source)(source)
@JvmName(name = "copyOfRangeInline")
actual inline fun <T> Array<T>.copyOfRange(fromIndex: Int, toIndex: Int): Array<T>(source)(source)
expect fun ByteArray.copyOfRange(fromIndex: Int, toIndex: Int): ByteArray(source)(source)
@JvmName(name = "copyOfRangeInline")
actual inline fun ByteArray.copyOfRange(fromIndex: Int, toIndex: Int): ByteArray(source)(source)
expect fun ShortArray.copyOfRange(fromIndex: Int, toIndex: Int): ShortArray(source)(source)
@JvmName(name = "copyOfRangeInline")
actual inline fun ShortArray.copyOfRange(fromIndex: Int, toIndex: Int): ShortArray(source)(source)
expect fun IntArray.copyOfRange(fromIndex: Int, toIndex: Int): IntArray(source)(source)
@JvmName(name = "copyOfRangeInline")
actual inline fun IntArray.copyOfRange(fromIndex: Int, toIndex: Int): IntArray(source)(source)
expect fun LongArray.copyOfRange(fromIndex: Int, toIndex: Int): LongArray(source)(source)
@JvmName(name = "copyOfRangeInline")
actual inline fun LongArray.copyOfRange(fromIndex: Int, toIndex: Int): LongArray(source)(source)
expect fun FloatArray.copyOfRange(fromIndex: Int, toIndex: Int): FloatArray(source)(source)
@JvmName(name = "copyOfRangeInline")
actual inline fun FloatArray.copyOfRange(fromIndex: Int, toIndex: Int): FloatArray(source)(source)
expect fun DoubleArray.copyOfRange(fromIndex: Int, toIndex: Int): DoubleArray(source)(source)
@JvmName(name = "copyOfRangeInline")
actual inline fun DoubleArray.copyOfRange(fromIndex: Int, toIndex: Int): DoubleArray(source)(source)
expect fun BooleanArray.copyOfRange(fromIndex: Int, toIndex: Int): BooleanArray(source)(source)
@JvmName(name = "copyOfRangeInline")
actual inline fun BooleanArray.copyOfRange(fromIndex: Int, toIndex: Int): BooleanArray(source)(source)
expect fun CharArray.copyOfRange(fromIndex: Int, toIndex: Int): CharArray(source)(source)
@JvmName(name = "copyOfRangeInline")
actual inline fun CharArray.copyOfRange(fromIndex: Int, toIndex: Int): CharArray(source)(source)

Returns a new array which is a copy of the specified range of the original array.

Since Kotlin

1.0

Parameters

fromIndex

the start of the range (inclusive) to copy.

toIndex

the end of the range (exclusive) to copy.

Throws

if fromIndex is less than zero or toIndex is greater than the size of this array.