From acb40ab8157425315249e7c307e6bfd80848034e Mon Sep 17 00:00:00 2001 From: Xuing Date: Sat, 23 Oct 2021 11:59:15 +0800 Subject: [PATCH] Update 06.7.md (#799) --- eBook/06.7.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eBook/06.7.md b/eBook/06.7.md index 1be6e40..1491611 100644 --- a/eBook/06.7.md +++ b/eBook/06.7.md @@ -28,7 +28,7 @@ func callback(y int, f func(int, int)) { 将函数作为参数的最好的例子是函数 `strings.IndexFunc()`: -该函数的签名是 `func IndexFunc(s string, f func(c rune) bool) int`,它的返回值是在函数 `f(c)` 返回 true、-1 或从未返回时的索引值。 +该函数的签名是 `func IndexFunc(s string, f func(c rune) bool) int`,它的返回值是字符串s中第一个使函数`f(c)`返回`true`的Unicode字符的索引值。如果找不到,则返回-1。 例如 `strings.IndexFunc(line, unicode.IsSpace)` 就会返回 `line` 中第一个空白字符的索引值。当然,您也可以书写自己的函数: