mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-12 06:36:43 +08:00
@@ -31,7 +31,7 @@ Go 支持以下 2 种形式的字面值:
|
||||
字符串的内容(纯字节)可以通过标准索引法来获取,在中括号 `[]` 内写入索引,索引从 0 开始计数:
|
||||
|
||||
- 字符串 str 的第 1 个字节:`str[0]`
|
||||
- 第 i 个字节:`str[i]`
|
||||
- 第 i 个字节:`str[i - 1]`
|
||||
- 最后 1 个字节:`str[len(str)-1]`
|
||||
|
||||
需要注意的是,这种转换方案只对纯 ASCII 码的字符串有效。
|
||||
|
Reference in New Issue
Block a user