Runes
Rune
is an alias for int32
. It is an UTF-8 encoded code point. When is thistype useful? One example is when you’re iterating over characters ina string. You could loop over each byte (which is only equivalent to a characterwhen strings are encoded in 8-bit ASCII, which they are not in Go!). But toget the actual characters you should use the rune
type.
当前内容版权归 Miek Gieben 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 Miek Gieben .