typeover
curriculum

Curriculum Foundations Strings, bytes, runes exercise 6 · fill-word

Strings, bytes, runes

TypeScript's split cuts a string into pieces, called as a method with the separator as the argument. Go's equivalent lives in the strings package and takes the string as the first argument. Fill in the package and function name.

TypeScript reference
Fill the blanks →

About this theme

Go strings are immutable byte sequences. There are no template literals — fmt.Sprintf does the job. A byte is an alias for uint8; a rune is int32 and represents a Unicode codepoint. When you range over a string, you get runes (codepoints), not bytes. This matters more than it sounds.