6. Manipulating Strings
C was created in America, back when it was fashionable to pretend that the rest of the world didn’t exist, so it used 7-bit ASCII1 characters to represent strings.
Go is more recent, and since then most technology companies in the USA have discovered that it’s quite a good idea to support other languages, mostly so you can sell things to people in other countries. Go uses UTF-8. This is entirely unsurprising, as UTF-8 was originally designed (on a diner placemat) by Rob Pike and Ken Thompson, two of the designers of Go.
Go strings are slightly higher-level than C strings, and there are some important differences. The most obvious is that the Go string type is immutable, like C constant strings and Java strings. Although ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access