Go 数据类型判断

一、使用Go的空接口: i.(type) 只能在switch中使用,函数没有返回值web func m_type(i interface{}) { switch i.(type) { case string: //... case int: //... } return } 二、使用反射: reflect.TypeOf(x)s
相关文章
相关标签/搜索