Go 中 Byte Rune
- byte 实质上就是 uint8 类型。byte 用来强调数据是 raw data,而不是数字;
rune 实质上就是 int32 类型。而 rune 用来表示 Unicode 的 code point。
uint8 the set of all unsigned 8-bit integers (0 to 255) int32 the set of all signed 32-bit integers (-2147483648 to 2147483647) byte alias for uint8 rune alias for int32
// byte is an alias for uint8 and is equivalent to uint8 in all ways. It is // used, by convention, to distinguish byte values from 8-bit unsigned // integer values. type byte = uint8 // rune is an alias for int32 and is equivalent to int32 in all ways. It is // used, by convention, to distinguish character values from integer values. type rune = int32
- 原文作者:TomatoAres
- 原文链接:https://TomatoAres.github.io/posts/byte-rune/
- 版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议进行许可,非商业转载请注明出处(作者,原文链接),商业转载请联系作者获得授权。