https://blog.csdn.net/whatday/article/details/107918399
1.string与int类型转换
- string转成int:
- int, err := strconv.Atoi(string)
- string转成int64:
- int64, err := strconv.ParseInt(string, 10, 64)
- int转成string:
- string := strconv.Itoa(int)
- int64转成string:
- string := strconv.FormatInt(int64,10)
2. string与float类型转换
- float64转成string:
- string := strconv.FormatFloat(float64,'E',-1,64)
- string转成float64:
- float64, _ := strconv.ParseFloat(string, 64) //string转float64