1
0
mirror of https://github.com/chai2010/advanced-go-programming-book.git synced 2025-05-28 23:42:21 +00:00

Merge pull request #79 from cloverstd/patch-1

typo: `str` should be `s`
This commit is contained in:
Xargin 2018-06-13 21:40:44 +08:00 committed by GitHub
commit 8df00101a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -268,7 +268,7 @@ fmt.Printf("%#v\n", string([]rune{'世', '界'})) // 世界
```go
func forOnString(s string, forBody func(i int, r rune)) {
for i := 0; len(s) > 0; {
r, size := utf8.DecodeRuneInString(str)
r, size := utf8.DecodeRuneInString(s)
forBody(i, r)
s = s[size:]
i += size