W3cubDocs

/Kotlin

contentToString

Platform and version requirements: JVM (1.1), JS (1.1), Native (1.1)
fun <T> Array<out T>.contentToString(): String
fun ByteArray.contentToString(): String
fun ShortArray.contentToString(): String
fun IntArray.contentToString(): String
fun LongArray.contentToString(): String
fun FloatArray.contentToString(): String
fun DoubleArray.contentToString(): String
fun BooleanArray.contentToString(): String
fun CharArray.contentToString(): String

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

import kotlin.test.*

fun main(args: Array<String>) {
//sampleStart
val array = arrayOf("apples", "oranges", "lime")

println(array.contentToString()) // [apples, oranges, lime]
//sampleEnd
}
Platform and version requirements: JVM (1.3), JS (1.3), Native (1.3)
@ExperimentalUnsignedTypes fun UIntArray.contentToString(): String
@ExperimentalUnsignedTypes fun ULongArray.contentToString(): String
@ExperimentalUnsignedTypes fun UByteArray.contentToString(): String
@ExperimentalUnsignedTypes fun UShortArray.contentToString(): String

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

import kotlin.test.*

fun main(args: Array<String>) {
//sampleStart
val array = arrayOf("apples", "oranges", "lime")

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

© 2010–2019 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/content-to-string.html