plus

expect operator fun plus(other: Any?): String(source)

Returns a string obtained by concatenating this string with the string representation of the given other object.

Since Kotlin

1.0

Samples

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
}
actual operator fun plus(other: Any?): String(source)

Returns a string obtained by concatenating this string with the string representation of the given other object.

Since Kotlin

1.1

Samples

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
}
actual operator fun plus(other: Any?): String(source)

Returns a string obtained by concatenating this string with the string representation of the given other object.

Since Kotlin

1.0

Samples

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
}
actual operator fun plus(other: Any?): String(source)

Returns a string obtained by concatenating this string with the string representation of the given other object.

Since Kotlin

1.3

Samples

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
}
actual operator fun plus(other: Any?): String(source)

Returns a string obtained by concatenating this string with the string representation of the given other object.

Since Kotlin

1.8

Samples

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
}
actual operator fun plus(other: Any?): String(source)

Returns a string obtained by concatenating this string with the string representation of the given other object.

Since Kotlin

1.8

Samples

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
}