From interface to []rune

134 views
Skip to first unread message

Денис Мухортов

unread,
Dec 8, 2021, 8:44:06 AM12/8/21
to golang-nuts
Can i get data from interface to []rune like that:
https://play.golang.com/p/XpXTeUgL-Tn
If so, how??

Marcin Romaszewicz

unread,
Dec 8, 2021, 1:28:39 PM12/8/21
to Денис Мухортов, golang-nuts
No, you can't. A string is not a []rune, but it can be type converted to one, so you have to type convert your interface to string, then convert to runes.

https://play.golang.com/p/GKITxGGYHZI

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/92755612-a157-4cc8-b6f5-fe65610ee1d7n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages