Golang fmt.Sprint() function example

package fmt

Sprint formats using the default formats for its operands and returns the resulting string. Spaces are added between operands when neither is a string.

Golang fmt.Sprint() function usage example

 package main

 import  "fmt"

 func main() {
 chinese := "你好"

 english := "Hello"

 malay := "apa khabar"

 concatenated := fmt.Sprint(chinese +" "+ english +" "+ malay)

 fmt.Println(concatenated)
 }

Output :

你好 Hello apa khabar

Reference :

http://golang.org/pkg/fmt/#Sprint

Advertisement