一、+拼接方式
s1 := "hello"
s2 := "word"
s3 := s1 + s2
fmt.Print(s3)
二、sprintf函数
s1 := "hello"
s2 := "word"
s3 := fmt.Sprintf("%s%s", s1, s2)
三、Join函数
s1 := "hello"
s2 := "word"
var str []string = []string{
s1, s2}
s3 := strings.Join(str, "")
fmt.Print(s3)
四、buffer.Builderbuffer.WriteString函数
s1 := "hello"
s2 := "word"
var bt bytes.Buffer
bt.WriteString(s1)
bt.WriteString(s2)
s3 := bt.String()
fmt.Println(s3)
五、buffer.Builder函数
s1 := "hello"
s2 := "word"
var build strings.Builder
build.WriteString(s1)
build.WriteString(s2)
s3 := build.String()
fmt.Println(s3)