String concatenation in Scala Last Updated : 02 Jul, 2021 Comments Improve Suggest changes Like Article Like Report A string is a sequence of characters. In Scala, objects of String are immutable which means a constant and cannot be changed once created. when a new string is created by adding two strings is known as a concatenation of strings. Scala provides concat() method to concatenate two strings, this method returns a new string which is created using two strings. we can also use ‘+’ operator to concatenate two strings. Syntax: str1.concat(str2); Or "str1" + "str2"; Below is the example of concatenating two strings.Using concat() method: This method appends argument to the string.Example #1: Scala // Scala program to illustrate how to // concatenate strings object GFG { // str1 and str2 are two strings var str1 = "Welcome! GeeksforGeeks " var str2 = " to Portal" // Main function def main(args: Array[String]) { // concatenate str1 and str2 strings // using concat() function var Newstr = str1.concat(str2); // Display strings println("String 1:" +str1); println("String 2:" +str2); println("New String :" +Newstr); // Concatenate strings using '+' operator println("This is the tutorial" + " of Scala language" + " on GFG portal"); } } Output: String 1:Welcome! GeeksforGeeks String 2: to Portal New String :Welcome! GeeksforGeeks to Portal This is the tutorial of Scala language on GFG portal In above example, we are joining the second string to the end of the first string by using concat() function. string 1 is Welcome! GeeksforGeeks string 2 is to Portal. After concatenating two string we get new string Welcome! GeeksforGeeks to Portal. Using + operator : we can add two string by using + operator.Example #2: Scala // Scala program to illustrate how to // concatenate strings // Creating object object GFG { // Main method def main(args: Array[String]) { var str1 = "Welcome to "; var str2 = "GeeksforGeeks"; // Concatenating two string println("After concatenate two string: " + str1 + str2); } } Output: After concatenate two string: Welcome toGeeksforGeeks In above example, string 1 is Welcome to string 2 is GeeksforGeeks. By using + operator concatenating two string we get output After concatenate two string: Welcome toGeeksforGeeks. Comment More infoAdvertise with us Next Article String concatenation in Scala D DivyaPareek Follow Improve Article Tags : Python Scala Scala-Strings Practice Tags : python Similar Reads Python String Concatenation String concatenation in Python allows us to combine two or more strings into one. In this article, we will explore various methods for achieving this. The most simple way to concatenate strings in Python is by using the + operator.Using + OperatorUsing + operator allows us to concatenation or join s 3 min read Scala | String Interpolation String Interpolation refers to substitution of defined variables or expressions in a given String with respected values. String Interpolation provides an easy way to process String literals. To apply this feature of Scala, we must follow few rules: String must be defined with starting character as s 3 min read String Concatenation in R Programming String concatenation is a way of appending two or more strings into a single string whether it is character by character or using some special character end to end. There are many ways to perform string concatenation. Example: Input: str1 = 'Geeks' str2 = 'for' str3 = 'Geeks' Output: 'GeeksforGeeks 3 min read Concatenate Two Maps in Scala The concatenation of Scala map is obtained by utilizing ++ operator. Syntax : def ++(xs: Map[(A, B)]): Map[A, B] Return Type: It returns a single map by concatenating two maps but it separates the identical keys. Example #1: Scala // Scala program of concatenating // two maps // Creating object obje 2 min read Scala List concatenation with example In order to concatenate two lists we need to utilize concat() method in Scala. Syntax: List.concat(l1, l2) In above syntax, l1 is list1 and l2 is list2. Below is the example to concat two lists in scala. Example #1: Scala // Scala program of concat() // method // Creating object object GfG { // Main 1 min read Like