函数可以作为其他函数的参数进行传递,然后在其他函数内执行,一般称为回调
strings.IndexFunc
根据指定条件查找字符总结
函数使用:用于将索引返回到满足f©的第一个Unicode代码点的s中,如果没有,则返回-1。
源码分析
PS D:\go\src> go doc -u -src strings.indexFunc
package strings // import "strings"
// IndexFunc returns the index into s of the first Unicode
// code point satisfying f(c), or -1 if none do.
func IndexFunc(s string, f func(rune) bool) int {