code:
var checkMark = "\u2713" // stand for rune "✓"
and how to convert unicode "\u2713" to the rune "✓" and print it ? Is anyone can help me, Thanks a lot very much.
code:
var checkMark = "\u2713" // stand for rune "✓"
and how to convert unicode "\u2713" to the rune "✓" and print it ? Is anyone can help me, Thanks a lot very much.
As if you have a string like "\u2713\u2715".
See in playground https://play.golang.org/p/AxpnCzNEOfr
package main
import (
"fmt"
"unicode/utf8"
)
func main() {
src := "\u2713\u2715"
r, _ := utf8.DecodeRuneInString(src)
fmt.Printf("the first rune of src is %v, code: %d",string(r), r)
}
// Output
// the first rune of src is ✓, code: 10003
More sample about utf8.DecodeRuneInString
can find from answer https://stackoverflow.com/a/54274978/10737552