Strings, bytes, runes and characters in Go - The Go Programming Language
5
公开标注数
5
参与人数
2026-07-25 10:01:10
首次 Whisper
本页的公开 Whisper
划选高亮2026-07-25 13:22:10
原文高亮摘录
“Some people think Go strings are always UTF-8”
Whisper 随想笔记
That's a common gotcha, but the docs make it pretty clear if you read carefully.
划选高亮2026-07-25 13:13:10
原文高亮摘录
“Some people think Go strings are always UTF-8”
Whisper 随想笔记
Wait, so my string can have random bytes? I thought Go was all UTF-8 man.
划选高亮2026-07-25 10:19:10
原文高亮摘录
“In Go, a string is in effect a read-only slice of bytes.”
Whisper 随想笔记
This clicked for me after fighting with UTF-8 for an hour.
划选高亮2026-07-25 10:10:10
原文高亮摘录
“In Go, a string is in effect a read-only slice of bytes.”
Whisper 随想笔记
Wait, does that mean string concat is just appending to a new slice?
划选高亮2026-07-25 10:01:10
原文高亮摘录
“In Go, a string is in effect a read-only slice of bytes.”
Whisper 随想笔记
So basically strings are just byte slices you can't modify, got it.
分享本页 Whisper
短链接
https://domwhisper.com/s/7493bfcaedd1嵌入代码
<iframe src="https://domwhisper.com/embed/7493bfcaedd1" width="100%" height="480" style="border:0;border-radius:16px" loading="lazy"></iframe>