Go的[]rune 和 []byte的差別
[]rune 和 []byte源碼
// 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.
原來是
byte
表示一個位元組,
rune
表示四個位元組,那麼就可以得出了結論了,來看一段代碼,使用中文字元串