Kotlin Join Strings (KJS)

In Kotlin, you can concatenate strings using the + operator or by using the plus() function available for the String object. Here is an example of its use:

Using the + Operator:

fun  main () {
     val string1 = "Hello, " 
    val string2 = "Kotlin!"

    val result = string1 + string2
    println(result)
}

Using the plus() Function:

fun  main () {
     val string1 = "Hello, " 
    val string2 = "Kotlin!"

    val result = string1.plus(string2)
    println(result)
}

Post a Comment

Previous Next

نموذج الاتصال