Convert a rune to a string in Go

This is an example Go program which demonstrates converting a rune (a single Unicode character) to a string.

package main

import (
        "fmt"
)

func main() {
        var r rune
        var s string
        r = '月'
        s = fmt.Sprintf("%c", r)
        fmt.Println(s)
}

(download)

The output of the example looks like this:


Copyright © Ben Bullock 2009-2019. All rights reserved. For comments, questions, and corrections, please email Ben Bullock (benkasminbullock@gmail.com) or use the discussion group at Google Groups. / Privacy / Disclaimer