去符文类型的解释 [英] Go rune type explanation
问题描述
我发现它是int32的别名,目的是区分数字和字符值。
http://golang.org/pkg / builtin /#rune
但我对符文这个词的含义感到困惑吗?例如uint == unsigned int
但我对符文它代表 ?例如uint == unsigned int
符文代表字母。 (符文是一组相关字母中的字母,称为符文字母,用于在采用拉丁字母之前编写各种日耳曼语言。[Wikipedia])。
如果一个变量在Go中有类型 rune
,那么你知道它是为了保存一个unicode代码点。 ( rune
比 codepoint
)更短更清晰。但它在技术上是一个int32,即它在内存中的表示是int32。
I have found rune type in Go and have a simple question but worth an explnation.
I fount that it is an alias for int32 and purpose is to distinguish number and character values.
http://golang.org/pkg/builtin/#rune
But I am confused with the term "rune" what actually it stands for ? e.g uint == unsigned int
But I am confused with the term "rune" what actually it stands for ? e.g uint == unsigned int
Rune stands for letter. ("Runes" are the letters in a set of related alphabets known as runic alphabets, which were used to write various Germanic languages before the adoption of the Latin alphabet. [Wikipedia]).
If a variable has type rune
in Go you know it is intended to hold a unicode code point. (rune
is shorter and clearer than codepoint
). But it is technical a int32, i.e. its representation in memory is that of an int32.
这篇关于去符文类型的解释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!