A Short Guide to Mastering Strings in Golang

Click for: original source

Chris Tomich post aiming to explain Go strings and their relationship to runes and bytes in a compact way.

He tries to point out two really important fundamentals of strings that need to be understood to mastering strings in Go.

  • the components of a string
  • the slice behaviour of a string

The first important rule of strings is that strings are made of up runes (not bytes). It’s important to understand that runes represent a single character and that different languages have different definitions of what constitutes a “character”. Also ranging over a string with a for loop returns runes.

We recommend to read whole article. Code example provided in the text.

[Read More]

Tags golang programming