IndexFunc returns the index into s of the first Unicode code point satisfying f(c), or -1 if none do.
package main import ( "fmt" "strings" "unicode" ) func main() { f := func(c rune) bool { return unicode.Is(unicode.Han, c) } fmt.Println(strings.IndexFunc("Hello, 世界", f)) fmt.Println(strings.IndexFunc("Hello, world", f)) }