They are supported as simple conversions :
ch := rune(97) n := int('a') fmt.Printf("char: %c\n", ch) fmt.Printf("code: %d\n", n)
Exit (try on the Go Playground ):
char: a code: 97
Note: you can also convert an integer numeric value to a string number , which basically interprets the integer value as a UTF-8 encoded value
s := string(97) fmt.Printf("text: %s\n", s)
Converting a signed or unsigned integer value to a string type gives a string containing a representation of the UTF-8 integer. Values ββoutside of valid Unicode code points are converted to "\uFFFD" .
icza
source share