🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
[TOC] golang interface 转 string,int,float64,其他类型 ## interface to other golang interface convert to other type ``` func interface2String(inter interface{}) { switch inter.(type) { case string: fmt.Println("string", inter.(string)) break case int: fmt.Println("int", inter.(int)) break case float64: fmt.Println("float64", inter.(float64)) break } } func main() { interface2String("jack") interface2String(1) interface2String(12.223) } ``` ## other convert interface