Go Language Tutorial
In Go programming, we can use ‘+’ operator or fmt.Sprintf function to concatenate the strings.
Simple Go program explains to use ‘+’ operator and fmt.Sprintf function to concatenate the strings.
package main import "fmt" func main() { var str1, str2 string str1 = "Welcome to " str2 = "codingpointer.com!" // Using '+' operator to concatenate strings str3 := str1 + str2 fmt.Println(str3) //Using fmt.Sprintf function str4 := fmt.Sprintf("%s%s", str1, str2) fmt.Println(str4) }Output:
$ go build string-concatenation.go $ ./string-concatenation Welcome to codingpointer.com! Welcome to codingpointer.com!« Previous Next »