what’s rune in Go?
tags: learning go programming tbc
content
TBC
what’s the result of fmt.Printf("%T %v\n", 'x', 'x')?
- go - What is a rune? - Stack Overflow
- builtin package - rune
- it’s literally just
type rune = int32
- it’s literally just
s := "this is a test"
for i, r := range s {
fmt.Printf("index %d:\n", i)
fmt.Printf("rune is %r\n", r) // some integer
fmt.Printf("its underlying int32 is %d\n" r) // some integer
fmt.Printf("the char its representing is %c\n", r) // the char
}