Scala - Join an iterable of strings Code Example

The code for Join an iterable of strings

object MyClass {
    def main(args: Array[String]) {
        val strings = Array("Hello", "Hey", "Hi", "Holla")
        
        // Joining the mkString()
        val result = strings.mkString(",")
        
        println("result: " + result)
    }
}

/*
Output:
result: Hello,Hey,Hi,Holla
*/
Code by IncludeHelp, on August 14, 2022 20:32

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.