copyOfRange

Platform and version requirements: Native (1.3)
fun <T> Array<T>.copyOfRange(
    fromIndex: Int, 
    toIndex: Int
): Array<T>
Platform and version requirements: JVM (1.0)
@JvmName("copyOfRangeInline") fun <T> Array<T>.copyOfRange(
    fromIndex: Int, 
    toIndex: Int
): Array<T>
Platform and version requirements: JS (1.1)
fun <T> Array<out T>.copyOfRange(
    fromIndex: Int, 
    toIndex: Int
): Array<T>
Platform and version requirements: JS (1.1), Native (1.3)
fun ByteArray.copyOfRange(
    fromIndex: Int, 
    toIndex: Int
): ByteArray
Platform and version requirements: JVM (1.0)
@JvmName("copyOfRangeInline") fun ByteArray.copyOfRange(
    fromIndex: Int, 
    toIndex: Int
): ByteArray
Platform and version requirements: JS (1.1), Native (1.3)
fun ShortArray.copyOfRange(
    fromIndex: Int, 
    toIndex: Int
): ShortArray
Platform and version requirements: JVM (1.0)
@JvmName("copyOfRangeInline") fun ShortArray.copyOfRange(
    fromIndex: Int, 
    toIndex: Int
): ShortArray
Platform and version requirements: JS (1.1), Native (1.3)
fun IntArray.copyOfRange(
    fromIndex: Int, 
    toIndex: Int
): IntArray
Platform and version requirements: JVM (1.0)
@JvmName("copyOfRangeInline") fun IntArray.copyOfRange(
    fromIndex: Int, 
    toIndex: Int
): IntArray
Platform and version requirements: JS (1.1), Native (1.3)
fun LongArray.copyOfRange(
    fromIndex: Int, 
    toIndex: Int
): LongArray
Platform and version requirements: JVM (1.0)
@JvmName("copyOfRangeInline") fun LongArray.copyOfRange(
    fromIndex: Int, 
    toIndex: Int
): LongArray
Platform and version requirements: JS (1.1), Native (1.3)
fun FloatArray.copyOfRange(
    fromIndex: Int, 
    toIndex: Int
): FloatArray
Platform and version requirements: JVM (1.0)
@JvmName("copyOfRangeInline") fun FloatArray.copyOfRange(
    fromIndex: Int, 
    toIndex: Int
): FloatArray
Platform and version requirements: JS (1.1), Native (1.3)
fun DoubleArray.copyOfRange(
    fromIndex: Int, 
    toIndex: Int
): DoubleArray
Platform and version requirements: JVM (1.0)
@JvmName("copyOfRangeInline") fun DoubleArray.copyOfRange(
    fromIndex: Int, 
    toIndex: Int
): DoubleArray
Platform and version requirements: JS (1.1), Native (1.3)
fun BooleanArray.copyOfRange(
    fromIndex: Int, 
    toIndex: Int
): BooleanArray
Platform and version requirements: JVM (1.0)
@JvmName("copyOfRangeInline") fun BooleanArray.copyOfRange(
    fromIndex: Int, 
    toIndex: Int
): BooleanArray
Platform and version requirements: JS (1.1), Native (1.3)
fun CharArray.copyOfRange(
    fromIndex: Int, 
    toIndex: Int
): CharArray
Platform and version requirements: JVM (1.0)
@JvmName("copyOfRangeInline") fun CharArray.copyOfRange(
    fromIndex: Int, 
    toIndex: Int
): CharArray

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

Parameters

fromIndex - the start of the range (inclusive) to copy.

toIndex - the end of the range (exclusive) to copy.

Exceptions

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

IllegalArgumentException - if fromIndex is greater than toIndex.

Platform and version requirements: JVM (1.3), JS (1.3), Native (1.3)
@ExperimentalUnsignedTypes fun UIntArray.copyOfRange(
    fromIndex: Int, 
    toIndex: Int
): UIntArray
@ExperimentalUnsignedTypes fun ULongArray.copyOfRange(
    fromIndex: Int, 
    toIndex: Int
): ULongArray
@ExperimentalUnsignedTypes fun UByteArray.copyOfRange(
    fromIndex: Int, 
    toIndex: Int
): UByteArray
@ExperimentalUnsignedTypes fun UShortArray.copyOfRange(
    fromIndex: Int, 
    toIndex: Int
): UShortArray

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

Parameters

fromIndex - the start of the range (inclusive) to copy.

toIndex - the end of the range (exclusive) to copy.

Exceptions

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

IllegalArgumentException - if fromIndex is greater than toIndex.

© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/copy-of-range.html