go中string和int类型相互转化
- string转化为int
nt, err := strconv.Atoi(str)
- string转化为int64
nt64, err := strconv.ParseInt(str, 10, 64)
- int转化为string
str := strconv.Itoa(nt)
- int64转化为string
str := strconv.FormatInt(nt64,10)
nt, err := strconv.Atoi(str)
nt64, err := strconv.ParseInt(str, 10, 64)
str := strconv.Itoa(nt)
str := strconv.FormatInt(nt64,10)