July 2019
Intermediate to advanced
458 pages
12h 12m
English
The strings package contains another structure that is very similar to the io.Reader interface, called strings.Reader. This works exactly like the first but the underlying value is a string instead of a slice of bytes.
One of the main advantages of using a string instead of the byte reader, when dealing with strings that need to be read, is the avoidance of copying the data when initializing it. This subtle difference helps with both performance and memory usage because it does fewer allocations and requires the Garbage Collector (GC) to clean up the copy.
Read now
Unlock full access