本文摘自php中文网,作者藏色散人,侵删。
go语言int64转string的方法:首先创建一个go示例文件;然后输入代码“i := int64(123)”;最后通过“s := strconv.FormatInt(i, 10)”方法将int64转string即可。

本文操作环境:Windows7系统、Go1.11.2、Dell G3电脑。
推荐:《golang教程》
int64转string
1 2 | i := int64(123)
s := strconv.FormatInt(i, 10)
|
第二个参数为基数,可选2~36
注:对于无符号整形,可以使用FormatUint(i uint64, base int)
PS:go语言string、int、int64互相转换
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | int,err:=strconv.Atoi(string)
int64, err := strconv.ParseInt(string, 10, 64)
string:=strconv.Itoa(int)
string:=strconv.FormatInt(int64,10)
float,err := strconv.ParseFloat(string,32/64)
string := strconv.FormatFloat(float32, 'E' , -1, 32)
string := strconv.FormatFloat(float64, 'E' , -1, 64)
|
以上就是go语言int64如何转string的详细内容,更多文章请关注木庄网络博客!!
相关阅读 >>
Go语言转义字符有哪些
Go语言map(集合)
Go语言有没有优势?
Go语言中包导入的一些问题
详解用Go语言实现查找两个数组的异同
Go语言有哪些包
Go语言结构体
Go语言值传递介绍
Go语言最适合做什么
Go语言定义一个数组的方法有哪些
更多相关阅读请进入《Go语言》频道 >>
老貘
一个与时俱进的Go编程知识库。
转载请注明出处:木庄网络博客 » go语言int64如何转string