- string转成int:
int, err := strconv.Atoi(string)
- string转成int64:
int64, err := strconv.ParseInt(string, 10, 64)
- string转成uint64:
uint64, err := strconv.ParseUint(string, 10, 64)
- int转成string:
string := strconv.Itoa(int)
- int64转成string:
string := strconv.FormatInt(int64,10)
- uint64转成string:
string := strconv.FormatUint(uint64,10)
Go中string和int类型相互转换
- 本文链接: https://zengwu.com.cn/p/bbd51f60.html
- 版权声明: 本博客所有文章遵循 CC 4.0 BY-SA 版权协议。转载请注明出处!