go int string 互转

2021-05-24  本文已影响0人  vins
int, err := strconv.Atoi(string)                              //string转成int
int64, err := strconv.ParseInt(string, 10, 64)                //string转成int64
string := strconv.Itoa(int)                                   //int转成string
string := strconv.FormatInt(int64,10)                         //int64转成string
int64_ := int64(int)                                          //int转int64
float, err := strconv.ParseFloat(string, 64)                  //string 转float64
float, err := strconv.ParseFloat(string, 32)                  //string 转float32

上一篇下一篇

猜你喜欢

热点阅读