golang 类型转换
例如将 []byte
类型的变量 IPBody
转换为字符串,直接使用 string(IPBody)
即可。
题外话
byte 类型 和 uint8 是一样的。
The Go Programming Language Specification
Numeric types
uint8 the set of all unsigned 8-bit integers (0 to 255)
byte alias for uint8
1
2
3
4
2
3
4
reference
- [1] 菜鸟教程. Go 语言类型转换open in new window
- [2] pingd. golang uint8、int8 与 byte 的区别open in new window
访客IP ,您的网络 访问优先
本站是个人博客,书写大数据、数据科学等领域的原创学习记录,转载请注明出处
本站运行于腾讯云