vault backup: 2026-05-14 16:11:17

This commit is contained in:
2026-05-14 16:11:17 +08:00
parent 229f125264
commit 1a9283a40f
6 changed files with 855 additions and 13 deletions
+3 -3
View File
@@ -301,9 +301,9 @@ s := string([]byte{'h', 'e', 'l', 'l', 'o'}) // "hello"
r := []rune("你好世界")
s := string(r) // "你好世界"
// ⚠️ 注意:[]rune 转 string 时不能对每个 rune 单独做 string(),必须整体转换
// string([]rune{65, 66}) ✅ → "AB"
// string(byte('A')) ❌ 编译错误,rune 不是 byte 的子类型
// ⚠️ byte 和 rune 是不同类型,不能混用:
// string(byte('A')) ❌ 编译错误,byte 不是 rune
// 处理中文/emoji 时必须用 []rune,而非 []byte
```
### []string → string(用分隔符拼接)