由于在开发过程中遇到类型转换问题,比如在web中某个参数是以string存在的,这个时候需要转换成其他类型,这里官方的strconv包里有这几种转换方法。...实现
有两个函数可以实现类型的互转(以int转string为例)
1. FormatInt (int64,base int)string
2....represented by the string.
// It accepts 1, t, T, TRUE, true, True, 0, f, F, FALSE, false, False.
// Any...有时候返回值是interface类型的,直接赋值是无法转化的。...(int)转化为类型。
可以通过a.(type)来判断a可以转为什么类型。
原文:https://blog.csdn.net/bobodem/article/details/80182096