golang怎么把字符串转成Int类型
16lz
2021-01-22
golang中字符串和各种int类型之间的相互转换方式:
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)
更多golang知识请关注golang教程栏目。
更多相关文章
- golang怎么拼接字符串数组
- golang判断错误类型的方法
- golang如何判断字符串是否为空
- 常见的 Go 处理字符串的技巧
- go语言中一些字符串操作介绍
- 详解 Go 中的不可变类型
- 用Go实现字符串的逆序
- 关于 Golang 字符串 格式化
- 总结 Go 的数据类型