You can
use + operator to concatenate two strings.
Example
var msg1
string = "Hello"
var msg2
string = "How Are You!!!!"
var space string
= " "
var result
string = msg1 + space + msg2
App.go
package main import "fmt" func main() { var msg1 string = "Hello" var msg2 string = "How Are You!!!!" var space string = " " var result string = msg1 + space + msg2 fmt.Printf("msg1 : %v\n", msg1) fmt.Printf("msg2 : %v\n", msg2) fmt.Printf("space : %v\n", space) fmt.Printf("result : %v\n", result) }
Output
msg1 : Hello msg2 : How Are You!!!! space : result : Hello How Are You!!!!
No comments:
Post a Comment