📅  最后修改于: 2022-03-11 14:45:02.468000             🧑  作者: Mango
// Simple Go program to illustrate
// how to create a rune
package main
import (
"fmt"
"reflect"
)
func main() {
// Creating a rune
rune1 := 'B'
rune2 := 'g'
rune3 := '\a'
// Displaying rune and its type
fmt.Printf("Rune 1: %c; Unicode: %U; Type: %s", rune1,
rune1, reflect.TypeOf(rune1))
fmt.Printf("\nRune 2: %c; Unicode: %U; Type: %s", rune2,
rune2, reflect.TypeOf(rune2))
fmt.Printf("\nRune 3: Unicode: %U; Type: %s", rune3,
reflect.TypeOf(rune3))
}
/*
Rune 1: B; Unicode: U+0042; Type: int32
Rune 2: g; Unicode: U+0067; Type: int32
Rune 3: Unicode: U+0007; Type: int32
*/