At first sight it might appear that these other languages' string types are more convenient than Go's since individual characters in their strings can be directly indexed—something only possible in Go if the string exclusively holds 7-bit ASCII characters (since these are all represented by a single UTF-8 byte). In practical terms this is never a problem for Go programmers: first, because direct indexing isn't used much in Go because Go supports character-by-character iteration over strings; second, because the standard library provides a comprehensive range of string searching and manipulation functions; and third, because we can always convert a Go string into a slice of Unicode code points (of type
- 3. Strings
- from Programming in Go: Creating Applications for the 21st Century
- Publisher: Addison-Wesley Professional
- Released: May 2012
Continuously refer back to this about variable-width characters.
Share this highlighthttp://www.safaribooksonline.com/a/programming-in-go/27951/