go语言string、int、int64互相转换

2019-8-25 liyangweb.com 李杨 Golang

import "strconv"  //先导入strconv包


// 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)

标签: go golang

评论(0) 浏览(166)

Powered by emlog 冀ICP备13011830号-1