From the course: Go for Developers: Practical Techniques for Effective Coding
Unlock this course with a free trial
Join today to access over 24,400 courses taught by industry experts.
Strings and UTF-8 - Go Tutorial
From the course: Go for Developers: Practical Techniques for Effective Coding
Strings and UTF-8
- A string is a sequence of one or more characters, letters, numbers, and symbols, that can either be a constant or a variable. Strings exist within either backquotes or double quotes. In Go, each of these have different characteristics depending on which one you use. If you use the backquotes, you are creating a raw string literal. If you use the double quotes, you are creating an interpreted string literal. Interpreted string literals are character sequences between double quotes. Within the quotes, any character may appear except new line and unescaped double quotes. You'll almost always use interpreted string literals because they allow for escape characters such as tabs and new lines. Interpreted strings are the most flexible of the two string types. Raw string literals are character sequences between backticks. Within these backticks, any character may appear except the backtick or backquote. Back slashes have no special meaning inside of raw string literals. For example…