Turning unicode code string to rune

123 views
Skip to first unread message

Tong Sun

unread,
Apr 22, 2017, 2:51:09 PM4/22/17
to golang-nuts
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

Thanks. 

Ivan Kurnosov

unread,
Apr 22, 2017, 10:42:05 PM4/22/17
to golang-nuts
1. Convert it to a number
2. Use `rune()`

Tong Sun

unread,
Apr 23, 2017, 10:19:24 AM4/23/17
to Ivan Kurnosov, golang-nuts

--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/U6sTX_6cNb8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

gary.wi...@victoriaplumb.com

unread,
Apr 24, 2017, 6:17:24 AM4/24/17
to golang-nuts
Reply all
Reply to author
Forward
0 new messages