contentToString

expect fun <T> Array<out T>?.contentToString(): String(source)

Returns a string representation of the contents of the specified array as if it is List.

Since Kotlin

1.4

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = arrayOf("apples", "oranges", "lime")

println(array.contentToString()) // [apples, oranges, lime] 
   //sampleEnd
}
actual fun <T> Array<out T>?.contentToString(): String(source)

Returns a string representation of the contents of the specified array as if it is List.

Since Kotlin

1.4

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = arrayOf("apples", "oranges", "lime")

println(array.contentToString()) // [apples, oranges, lime] 
   //sampleEnd
}
actual inline fun <T> Array<out T>?.contentToString(): String(source)
actual inline fun ByteArray?.contentToString(): String(source)
actual inline fun ShortArray?.contentToString(): String(source)
actual inline fun IntArray?.contentToString(): String(source)
actual inline fun LongArray?.contentToString(): String(source)
actual inline fun FloatArray?.contentToString(): String(source)
actual inline fun DoubleArray?.contentToString(): String(source)
actual inline fun BooleanArray?.contentToString(): String(source)
actual inline fun CharArray?.contentToString(): String(source)

Returns a string representation of the contents of the specified array as if it is List.

Since Kotlin

1.4

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = arrayOf("apples", "oranges", "lime")

println(array.contentToString()) // [apples, oranges, lime] 
   //sampleEnd
}
actual fun <T> Array<out T>?.contentToString(): String(source)

Returns a string representation of the contents of the specified array as if it is List.

Since Kotlin

1.4

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = arrayOf("apples", "oranges", "lime")

println(array.contentToString()) // [apples, oranges, lime] 
   //sampleEnd
}

Deprecated

Hidden since 1.4

Use Kotlin compiler 1.4 to avoid deprecation warning.

Returns a string representation of the contents of the specified array as if it is List.

Since Kotlin

1.3

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = arrayOf("apples", "oranges", "lime")

println(array.contentToString()) // [apples, oranges, lime] 
   //sampleEnd
}
actual fun <T> Array<out T>?.contentToString(): String(source)

Returns a string representation of the contents of the specified array as if it is List.

Since Kotlin

1.8

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = arrayOf("apples", "oranges", "lime")

println(array.contentToString()) // [apples, oranges, lime] 
   //sampleEnd
}

Deprecated

Hidden since 1.4

Use Kotlin compiler 1.4 to avoid deprecation warning.

Returns a string representation of the contents of the specified array as if it is List.

Since Kotlin

1.8

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = arrayOf("apples", "oranges", "lime")

println(array.contentToString()) // [apples, oranges, lime] 
   //sampleEnd
}
actual fun <T> Array<out T>?.contentToString(): String(source)

Returns a string representation of the contents of the specified array as if it is List.

Since Kotlin

1.8

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = arrayOf("apples", "oranges", "lime")

println(array.contentToString()) // [apples, oranges, lime] 
   //sampleEnd
}

Deprecated

Hidden since 1.4

Use Kotlin compiler 1.4 to avoid deprecation warning.

Returns a string representation of the contents of the specified array as if it is List.

Since Kotlin

1.8

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = arrayOf("apples", "oranges", "lime")

println(array.contentToString()) // [apples, oranges, lime] 
   //sampleEnd
}