mirror of
https://github.com/chai2010/advanced-go-programming-book.git
synced 2025-05-24 04:22:22 +00:00
typo
This commit is contained in:
parent
afea2cba2d
commit
3889bee131
@ -281,9 +281,9 @@ func forOnString(s string, forBody func(i int, r rune)) {
|
|||||||
**`[]byte(s)`转换模拟实现**
|
**`[]byte(s)`转换模拟实现**
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func str2bytes(s []byte) []bytes {
|
func str2bytes(s string) []byte {
|
||||||
p := make([]byte, len(s))
|
p := make([]byte, len(s))
|
||||||
for i, c := []byte(s) {
|
for i, c := range []byte(s) {
|
||||||
p[i] = c
|
p[i] = c
|
||||||
}
|
}
|
||||||
return p
|
return p
|
||||||
|
Loading…
x
Reference in New Issue
Block a user