O'Reilly logo

The Go Programming Language Phrasebook by David Chisnall

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required