Middle+
What data type in Go is used to represent Unicode characters?
sobes.tech AI
Answer from AI
In Go, the rune type is used to represent Unicode characters. It is an alias for int32, which stores the Unicode code point. For example:
var ch rune = 'Я' // Unicode character
fmt.Printf("%c %U\n", ch, ch) // Outputs: Я U+042F
The byte type (alias for uint8) is typically used for bytes, while rune is used for Unicode characters.