plus
Требования к платформе и версии: Common (1.0), JS (1.1), JVM (1.0), Native (1.3), Wasm-JS (1.8), Wasm-WASI (1.8)
expect operator fun plus(other: Any?): String
Возвращает строку, полученную объединением этой строки со строковым представлением заданного объекта other.
Примеры
import kotlin.test.*
fun main() {
//sampleStart
println("Ko" + "dee") // Kodee
// 2 is not a string, but plus concatenates its string representation with the "Kotlin " string
println("Kotlin " + 2) // Kotlin 2
// list is converted to a String first and then concatenated with the "Numbers: " string
println("Numbers: " + listOf(1, 2, 3)) // Numbers: [1, 2, 3]
//sampleEnd
}
© 2010–2026 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/plus.html