Go Strings Bytes Runes

Guides Go string handling as what a string actually is — an immutable, read-only slice of UTF-8 bytes where indexing yields a byte (not a character), len is a byte count (not a rune count), for range decodes runes while an indexed for walks bytes, []byte/[]rune conversions copy, string(intValue) is the code-point trap go vet flags, strings.Builder (not += in a loop) builds strings without O(n²) reallocation, and strconv beats fmt.Sprintf in hot paths. Auto-invokes when writing or editing string indexing/iteration, []byte/[]rune conversions, string concatenation in loops, strconv vs fmt, string(int), or on "why is len wrong for this unicode string" requests. The depth behind the policy root's "use the most standard tools" for text.

ctoth 50103c4 3 files · 27.8 KB Updated

File contents

ctoth/golang-skills-plugin/tree/main/plugins/golang/skills/go-strings-bytes-runes commit 50103c43e4

Frequently asked questions

npx skillmds@latest add ctoth/go-strings-bytes-runes