golang rune
n. |
如尼字母(属于北欧古文字体系); 神秘的记号; 有魔力的符号; |
[例句]By chance he stumbles upon a Rune and is exposed to its magical powers.
一次偶然的机会,他发现了一个卢恩文并且暴露于它的神秘力量之下。
[其他] | 复数:runes |
rune | 英 [ruːn] | 美 [ruːn] |
查询,官方的解释如下:
// 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.
//int32的别名,几乎在所有方面等同于int32
//它用来区分字符值和整数值
type rune = int32
golang中string底层是通过byte数组实现的。中文字符在unicode下占2个字节,在utf-8编码下占3个字节,而golang默认编码正好是utf-8。
链接:https://www.jianshu.com/p/4fbf529926ca