在Go语言中,可以使用strconv包中的函数将int64类型转换为string类型。具体的方法如下:

import (
	"fmt"
	"strconv"
)

func main() {
	num := int64(1234567890)
	str := strconv.FormatInt(num, 10)
	fmt.Println(str)
}

输出结果为:

1234567890

在上面的代码中,使用了strconv.FormatInt()函数将int64类型的数字转换为十进制的字符串。第一个参数是要转换的数字,第二个参数是要转换的进制,这里选择了十进制(10)。

golang int64转string

原文地址: https://www.cveoy.top/t/topic/hAK6 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录