Skip to content

Commit a30f35a

Browse files
Eric719unknwon
authored andcommittedNov 20, 2016
fix byte (unknwon#291)
1 parent ad0d1e8 commit a30f35a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎eBook/07.6.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## 7.6.1 从字符串生成字节切片
44

5-
假设 s 是一个字符串(本质上是一个字节数组),那么就可以直接通过 `c := []bytes(s)` 来获取一个字节的切片 c。另外,您还可以通过 copy 函数来达到相同的目的:`copy(dst []byte, src string)`
5+
假设 s 是一个字符串(本质上是一个字节数组),那么就可以直接通过 `c := []byte(s)` 来获取一个字节的切片 c。另外,您还可以通过 copy 函数来达到相同的目的:`copy(dst []byte, src string)`
66

77
同样的,还可以使用 for-range 来获得每个元素(Listing 7.13—for_string.go):
88

0 commit comments

Comments
 (0)
Please sign in to comment.