In Kotlin, you can concatenate 1. using string interpolation / templates
val a = "Hello"
val b = "World"
val c = "$a $b"
- using the + /
plus()
operatorval a = "Hello" val b = "World" val c = a + b // same as calling operator function a.plus(b) val c = a.plus(b) print(c)
- using the
StringBuilder
val a = "Hello" val b = "World" val sb = StringBuilder() sb.append(a).append(b) val c = sb.toString() print(c)