In Golang, how to convert a string to unicode rune array and back?

In Golang, how to convert a string to unicode rune array and do the reverse way?

Convert string s to a rune array:

runes := []rune(s)

Convert a rune array runes to string:

str := string(runes)

Eric Ma

Eric is a systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.

Leave a Reply

Your email address will not be published. Required fields are marked *