In Golang, to convert a string to byte array, you get a slice that contains the bytes of the string. In Go, a string is, in effect, a read-only slice of bytes. It’s essential to state right up front that a string holds arbitrary bytes. It is not required to hold Unicode text, UTF-8 text, or any other predefined format. As far as the content of a string is concerned, it is precisely equivalent to a slice of bytes.

#go #golang

Golang: How To Convert String to Byte Array Example
2.30 GEEK