string rune code example
Example 1: print unicode character in golang
package main
import (
"fmt"
)
func main() {
for i := 33; i <= 126; i++ {
//fmt.Printf("%d: %c ", i, i) //Prints ONLY the unicode chars
fmt.Printf("%d: %#U ", i, i) //Prints the unicode chars and values as well
}
}
Example 2: golang convert rune to string
r := rune('a')
fmt.Println(r, string(r))