copyOf

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

Since Kotlin

1.3

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = arrayOf("apples", "oranges", "limes")
val arrayCopy = array.copyOf()
println(arrayCopy.contentToString()) // [apples, oranges, limes] 
   //sampleEnd
}

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with zero values if necessary.

  • If newSize is less than the size of the original array, the copy array is truncated to the newSize.

  • If newSize is greater than the size of the original array, the extra elements in the copy array are filled with zero values.

Since Kotlin

1.3

expect fun <T> Array<T>.copyOf(): Array<T>(source)

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

Since Kotlin

1.0

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = arrayOf("apples", "oranges", "limes")
val arrayCopy = array.copyOf()
println(arrayCopy.contentToString()) // [apples, oranges, limes] 
   //sampleEnd
}

expect fun <T> Array<T>.copyOf(newSize: Int): Array<T?>(source)

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with null values if necessary.

  • If newSize is less than the size of the original array, the copy array is truncated to the newSize.

  • If newSize is greater than the size of the original array, the extra elements in the copy array are filled with null values.

Since Kotlin

1.0

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = arrayOf("apples", "oranges", "limes")
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [apples, oranges, limes, null, null]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [apples, oranges] 
   //sampleEnd
}

expect fun ByteArray.copyOf(newSize: Int): ByteArray(source)
expect fun ShortArray.copyOf(newSize: Int): ShortArray(source)
expect fun IntArray.copyOf(newSize: Int): IntArray(source)
expect fun LongArray.copyOf(newSize: Int): LongArray(source)
expect fun FloatArray.copyOf(newSize: Int): FloatArray(source)
expect fun DoubleArray.copyOf(newSize: Int): DoubleArray(source)

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with zero values if necessary.

  • If newSize is less than the size of the original array, the copy array is truncated to the newSize.

  • If newSize is greater than the size of the original array, the extra elements in the copy array are filled with zero values.

Since Kotlin

1.0

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}

expect fun BooleanArray.copyOf(newSize: Int): BooleanArray(source)

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with false values if necessary.

  • If newSize is less than the size of the original array, the copy array is truncated to the newSize.

  • If newSize is greater than the size of the original array, the extra elements in the copy array are filled with false values.

Since Kotlin

1.0

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}

expect fun CharArray.copyOf(newSize: Int): CharArray(source)

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with null char (\u0000) values if necessary.

  • If newSize is less than the size of the original array, the copy array is truncated to the newSize.

  • If newSize is greater than the size of the original array, the extra elements in the copy array are filled with null char (\u0000) values.

Since Kotlin

1.0

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}
inline fun <T> Array<out T>.copyOf(): Array<T>(source)
actual inline fun ByteArray.copyOf(): ByteArray(source)
actual inline fun ShortArray.copyOf(): ShortArray(source)
actual inline fun IntArray.copyOf(): IntArray(source)
actual inline fun FloatArray.copyOf(): FloatArray(source)
actual inline fun DoubleArray.copyOf(): DoubleArray(source)

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

Since Kotlin

1.1

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = arrayOf("apples", "oranges", "limes")
val arrayCopy = array.copyOf()
println(arrayCopy.contentToString()) // [apples, oranges, limes] 
   //sampleEnd
}

fun <T> Array<out T>.copyOf(newSize: Int): Array<T?>(source)

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with null values if necessary.

  • If newSize is less than the size of the original array, the copy array is truncated to the newSize.

  • If newSize is greater than the size of the original array, the extra elements in the copy array are filled with null values.

Since Kotlin

1.1

actual fun ByteArray.copyOf(newSize: Int): ByteArray(source)
actual fun ShortArray.copyOf(newSize: Int): ShortArray(source)
actual fun IntArray.copyOf(newSize: Int): IntArray(source)
actual fun LongArray.copyOf(newSize: Int): LongArray(source)
actual fun FloatArray.copyOf(newSize: Int): FloatArray(source)
actual fun DoubleArray.copyOf(newSize: Int): DoubleArray(source)

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with zero values if necessary.

  • If newSize is less than the size of the original array, the copy array is truncated to the newSize.

  • If newSize is greater than the size of the original array, the extra elements in the copy array are filled with zero values.

Since Kotlin

1.1

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}

actual fun BooleanArray.copyOf(newSize: Int): BooleanArray(source)

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with false values if necessary.

  • If newSize is less than the size of the original array, the copy array is truncated to the newSize.

  • If newSize is greater than the size of the original array, the extra elements in the copy array are filled with false values.

Since Kotlin

1.1

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}

actual fun CharArray.copyOf(newSize: Int): CharArray(source)

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with null char (\u0000) values if necessary.

  • If newSize is less than the size of the original array, the copy array is truncated to the newSize.

  • If newSize is greater than the size of the original array, the extra elements in the copy array are filled with null char (\u0000) values.

Since Kotlin

1.1

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}
actual inline fun <T> Array<T>.copyOf(): Array<T>(source)
actual inline fun ByteArray.copyOf(): ByteArray(source)
actual inline fun ShortArray.copyOf(): ShortArray(source)
actual inline fun IntArray.copyOf(): IntArray(source)
actual inline fun LongArray.copyOf(): LongArray(source)
actual inline fun FloatArray.copyOf(): FloatArray(source)
actual inline fun DoubleArray.copyOf(): DoubleArray(source)
actual inline fun BooleanArray.copyOf(): BooleanArray(source)
actual inline fun CharArray.copyOf(): CharArray(source)

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

Since Kotlin

1.0

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = arrayOf("apples", "oranges", "limes")
val arrayCopy = array.copyOf()
println(arrayCopy.contentToString()) // [apples, oranges, limes] 
   //sampleEnd
}

actual inline fun <T> Array<T>.copyOf(newSize: Int): Array<T?>(source)

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with null values if necessary.

  • If newSize is less than the size of the original array, the copy array is truncated to the newSize.

  • If newSize is greater than the size of the original array, the extra elements in the copy array are filled with null values.

Since Kotlin

1.0

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = arrayOf("apples", "oranges", "limes")
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [apples, oranges, limes, null, null]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [apples, oranges] 
   //sampleEnd
}

actual inline fun ByteArray.copyOf(newSize: Int): ByteArray(source)
actual inline fun ShortArray.copyOf(newSize: Int): ShortArray(source)
actual inline fun IntArray.copyOf(newSize: Int): IntArray(source)
actual inline fun LongArray.copyOf(newSize: Int): LongArray(source)
actual inline fun FloatArray.copyOf(newSize: Int): FloatArray(source)
actual inline fun DoubleArray.copyOf(newSize: Int): DoubleArray(source)

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with zero values if necessary.

  • If newSize is less than the size of the original array, the copy array is truncated to the newSize.

  • If newSize is greater than the size of the original array, the extra elements in the copy array are filled with zero values.

Since Kotlin

1.0

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}

actual inline fun BooleanArray.copyOf(newSize: Int): BooleanArray(source)

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with false values if necessary.

  • If newSize is less than the size of the original array, the copy array is truncated to the newSize.

  • If newSize is greater than the size of the original array, the extra elements in the copy array are filled with false values.

Since Kotlin

1.0

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}

actual inline fun CharArray.copyOf(newSize: Int): CharArray(source)

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with null char (\u0000) values if necessary.

  • If newSize is less than the size of the original array, the copy array is truncated to the newSize.

  • If newSize is greater than the size of the original array, the extra elements in the copy array are filled with null char (\u0000) values.

Since Kotlin

1.0

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}
actual fun <T> Array<T>.copyOf(): Array<T>(source)

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

Since Kotlin

1.3

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = arrayOf("apples", "oranges", "limes")
val arrayCopy = array.copyOf()
println(arrayCopy.contentToString()) // [apples, oranges, limes] 
   //sampleEnd
}

actual fun <T> Array<T>.copyOf(newSize: Int): Array<T?>(source)

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with null values if necessary.

  • If newSize is less than the size of the original array, the copy array is truncated to the newSize.

  • If newSize is greater than the size of the original array, the extra elements in the copy array are filled with null values.

Since Kotlin

1.3

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = arrayOf("apples", "oranges", "limes")
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [apples, oranges, limes, null, null]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [apples, oranges] 
   //sampleEnd
}

actual fun ByteArray.copyOf(newSize: Int): ByteArray(source)
actual fun ShortArray.copyOf(newSize: Int): ShortArray(source)
actual fun IntArray.copyOf(newSize: Int): IntArray(source)
actual fun LongArray.copyOf(newSize: Int): LongArray(source)
actual fun FloatArray.copyOf(newSize: Int): FloatArray(source)
actual fun DoubleArray.copyOf(newSize: Int): DoubleArray(source)

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with zero values if necessary.

  • If newSize is less than the size of the original array, the copy array is truncated to the newSize.

  • If newSize is greater than the size of the original array, the extra elements in the copy array are filled with zero values.

Since Kotlin

1.3

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}

actual fun BooleanArray.copyOf(newSize: Int): BooleanArray(source)

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with false values if necessary.

  • If newSize is less than the size of the original array, the copy array is truncated to the newSize.

  • If newSize is greater than the size of the original array, the extra elements in the copy array are filled with false values.

Since Kotlin

1.3

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}

actual fun CharArray.copyOf(newSize: Int): CharArray(source)

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with null char (\u0000) values if necessary.

  • If newSize is less than the size of the original array, the copy array is truncated to the newSize.

  • If newSize is greater than the size of the original array, the extra elements in the copy array are filled with null char (\u0000) values.

Since Kotlin

1.3

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}
actual fun <T> Array<T>.copyOf(): Array<T>(source)

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

Since Kotlin

1.8

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = arrayOf("apples", "oranges", "limes")
val arrayCopy = array.copyOf()
println(arrayCopy.contentToString()) // [apples, oranges, limes] 
   //sampleEnd
}

actual fun <T> Array<T>.copyOf(newSize: Int): Array<T?>(source)

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with null values if necessary.

  • If newSize is less than the size of the original array, the copy array is truncated to the newSize.

  • If newSize is greater than the size of the original array, the extra elements in the copy array are filled with null values.

Since Kotlin

1.8

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = arrayOf("apples", "oranges", "limes")
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [apples, oranges, limes, null, null]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [apples, oranges] 
   //sampleEnd
}

actual fun ByteArray.copyOf(newSize: Int): ByteArray(source)
actual fun ShortArray.copyOf(newSize: Int): ShortArray(source)
actual fun IntArray.copyOf(newSize: Int): IntArray(source)
actual fun LongArray.copyOf(newSize: Int): LongArray(source)
actual fun FloatArray.copyOf(newSize: Int): FloatArray(source)
actual fun DoubleArray.copyOf(newSize: Int): DoubleArray(source)

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with zero values if necessary.

  • If newSize is less than the size of the original array, the copy array is truncated to the newSize.

  • If newSize is greater than the size of the original array, the extra elements in the copy array are filled with zero values.

Since Kotlin

1.8

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}

actual fun BooleanArray.copyOf(newSize: Int): BooleanArray(source)

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with false values if necessary.

  • If newSize is less than the size of the original array, the copy array is truncated to the newSize.

  • If newSize is greater than the size of the original array, the extra elements in the copy array are filled with false values.

Since Kotlin

1.8

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}

actual fun CharArray.copyOf(newSize: Int): CharArray(source)

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with null char (\u0000) values if necessary.

  • If newSize is less than the size of the original array, the copy array is truncated to the newSize.

  • If newSize is greater than the size of the original array, the extra elements in the copy array are filled with null char (\u0000) values.

Since Kotlin

1.8

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}
actual fun <T> Array<T>.copyOf(): Array<T>(source)

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

Since Kotlin

1.8

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = arrayOf("apples", "oranges", "limes")
val arrayCopy = array.copyOf()
println(arrayCopy.contentToString()) // [apples, oranges, limes] 
   //sampleEnd
}

actual fun <T> Array<T>.copyOf(newSize: Int): Array<T?>(source)

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with null values if necessary.

  • If newSize is less than the size of the original array, the copy array is truncated to the newSize.

  • If newSize is greater than the size of the original array, the extra elements in the copy array are filled with null values.

Since Kotlin

1.8

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = arrayOf("apples", "oranges", "limes")
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [apples, oranges, limes, null, null]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [apples, oranges] 
   //sampleEnd
}

actual fun ByteArray.copyOf(newSize: Int): ByteArray(source)
actual fun ShortArray.copyOf(newSize: Int): ShortArray(source)
actual fun IntArray.copyOf(newSize: Int): IntArray(source)
actual fun LongArray.copyOf(newSize: Int): LongArray(source)
actual fun FloatArray.copyOf(newSize: Int): FloatArray(source)
actual fun DoubleArray.copyOf(newSize: Int): DoubleArray(source)

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with zero values if necessary.

  • If newSize is less than the size of the original array, the copy array is truncated to the newSize.

  • If newSize is greater than the size of the original array, the extra elements in the copy array are filled with zero values.

Since Kotlin

1.8

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}

actual fun BooleanArray.copyOf(newSize: Int): BooleanArray(source)

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with false values if necessary.

  • If newSize is less than the size of the original array, the copy array is truncated to the newSize.

  • If newSize is greater than the size of the original array, the extra elements in the copy array are filled with false values.

Since Kotlin

1.8

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}

actual fun CharArray.copyOf(newSize: Int): CharArray(source)

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with null char (\u0000) values if necessary.

  • If newSize is less than the size of the original array, the copy array is truncated to the newSize.

  • If newSize is greater than the size of the original array, the extra elements in the copy array are filled with null char (\u0000) values.

Since Kotlin

1.8

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}