Interface To String Golang

[Solved] Interface To String Golang | Go - Code Explorer | yomemimo.com
Question : interface to string golang

Answered by : bugs-bunny

var x interface{} = "abc"
str := fmt.Sprintf("%v", x)

Source : https://yourbasic.org/golang/interface-to-string/ | Last Update : Sat, 15 Aug 20

Question : interface to string in golang

Answered by : restu-wahyu-saputra

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

Source : | Last Update : Fri, 30 Apr 21

Answers related to interface to string golang

Code Explorer Popular Question For Go