一、字符串转int
func Atoi(s string) (int, error)
案例:
执行结果:
sf@SFdeMacBook-Pro ~/Documents/project/src/test go build int_string.go
sf@SFdeMacBook-Pro ~/Documents/project/src/test ./int_string
int, 100
二、int转字符串
func Itoa(i int) string
执行结果:
sf@SFdeMacBook-Pro ~/Documents/project/src/test go build int_string.go
sf@SFdeMacBook-Pro ~/Documents/project/src/test ./int_string
string,100
有疑问加站长微信联系(非本文作者)