From 249a2f08956eb8c5ba8afb14c0e2c0633941c243 Mon Sep 17 00:00:00 2001 From: chai2010 Date: Mon, 2 Jul 2018 22:24:06 +0800 Subject: [PATCH] =?UTF-8?q?ch1-03:=20=E4=BF=AE=E5=A4=8D=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E4=B8=B2=E9=83=A8=E5=88=86=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ch1-basic/ch1-03-array-string-and-slice.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ch1-basic/ch1-03-array-string-and-slice.md b/ch1-basic/ch1-03-array-string-and-slice.md index 1742dfe..cbf5760 100644 --- a/ch1-basic/ch1-03-array-string-and-slice.md +++ b/ch1-basic/ch1-03-array-string-and-slice.md @@ -177,7 +177,7 @@ s1 := "hello, world"[:5] s2 := "hello, world"[7:] ``` -和数组一样,内置的`len`和`cap`函数返回相同的结果,都对应字符串的长度。也可以通过`reflect.StringHeader`结构访问字符串的长度(这里只是为了演示字符串的结构,并不是推荐的做法): +字符串和数组类似,内置的`len`函数返回字符串的长度。也可以通过`reflect.StringHeader`结构访问字符串的长度(这里只是为了演示字符串的结构,并不是推荐的做法): ```go fmt.Println("len(s):", (*reflect.StringHeader)(unsafe.Pointer(&s)).Len) // 12