1
0
mirror of https://github.com/chai2010/advanced-go-programming-book.git synced 2025-05-24 12:32:21 +00:00

Update ch1-03-array-string-and-slice.md

This commit is contained in:
smallwhite 2019-01-02 10:41:43 +08:00 committed by GitHub
parent d7edf7ef66
commit 730667e5ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -329,8 +329,8 @@ func bytes2str(s []byte) (p string) {
func str2runes(s []byte) []rune { func str2runes(s []byte) []rune {
var p []int32 var p []int32
for len(s) > 0 { for len(s) > 0 {
r, size := utf8.DecodeRuneInString(s) r, size := utf8.DecodeRune(s)
p = append(p, r) p = append(p, int32(r))
s = s[size:] s = s[size:]
} }
return []rune(p) return []rune(p)