The bottom layer of the GO string is an example analysis of a byte array.
This article mainly shows you the "GO string bottom is a byte array example analysis", the content is easy to understand, clear, hope to help you solve the doubt, the following let the editor lead you to study and learn "the bottom layer of the GO string is a byte array example analysis" this article.
At the bottom of the string is a byte array.
This is really important and affects several other techniques below. When you create a string, it is essentially an array of bytes. This means that you can access a single byte like an array. For example, the following code prints each byte in the string and each byte in the corresponding byte array one by one:
Package mainimport "fmt" func main () {str: = "hello" for I: = 0; I < len (str); iTunes + {fmt.Printf ("% b% s\ n", str [I], string (stri])}} above is all the contents of the article "the bottom of the GO string is a sample analysis of a byte array". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!