Answers for "interface to string golang"

Go
5

interface to string golang

var x interface{} = "abc"
str := fmt.Sprintf("%v", x)
Posted by: Guest on August-08-2020
0

interface to string in golang

var x interface{} = []int{1, 2, 3}
str1 := fmt.Sprintf("%v", x)
str2 := x.(string)

fmt.Println(str1)
fmt.Println(str2)
Posted by: Guest on April-23-2021

Code answers related to "interface to string golang"

Browse Popular Code Answers by Language