goのruneにサロゲートペアになる文字を書けないなあと悩んでた

$ cat beers.go

package main

func main() {

const x rune = '\u1F37B'

println(string(x))

}

$ go run beers.go

# command-line-arguments

./beers.go:4:17: more than one character in rune literal

んだけど8桁書くべきだった

$ cat beers.go

package main

func main() {

const x rune = '\U0001F37B'

println(string(x))

}

$ go run beers.go

🍻

Reply to this note

Please Login to reply.

Discussion

No replies yet.