See: https://golang.org/pkg/unicode/utf8/#DecodeRuneInString
On Saturday, 22 April 2017 19:51:09 UTC+1, Tong Sun wrote:
>
> Hi,
>
> Given a unicode code string, be it "4e16", or "0x4e16", or "u4e16", how to
> turn it into a single char rune?
>
> You can finish the code at https://play.golang.org
Thanks a lot Ivan!
FTR: https://play.golang.org/p/tYfn9L12vD
and also,
https://github.com/suntong/lang/blob/master/lang/Go/src/text/Rune.go
On Sat, Apr 22, 2017 at 10:42 PM, Ivan Kurnosov wrote:
> 1. Convert it to a number
> 2. Use `rune()`
>
>
> On Sunday, April 23, 2017 at 6:51:09 AM UTC+12,
1. Convert it to a number
2. Use `rune()`
On Sunday, April 23, 2017 at 6:51:09 AM UTC+12, Tong Sun wrote:
>
> Hi,
>
> Given a unicode code string, be it "4e16", or "0x4e16", or "u4e16", how to
> turn it into a single char rune?
>
> You can finish the code at https://play.golang.org/p/AFIEz3eJVz