We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 74e3be8 commit a5083bbCopy full SHA for a5083bb
src/strings/strings.go
@@ -698,17 +698,10 @@ func LastIndexFunc(s string, f func(rune) bool) int {
698
// truth==false, the sense of the predicate function is
699
// inverted.
700
func indexFunc(s string, f func(rune) bool, truth bool) int {
701
- start := 0
702
- for start < len(s) {
703
- wid := 1
704
- r := rune(s[start])
705
- if r >= utf8.RuneSelf {
706
- r, wid = utf8.DecodeRuneInString(s[start:])
707
- }
+ for i, r := range s {
708
if f(r) == truth {
709
- return start
+ return i
710
}
711
- start += wid
712
713
return -1
714
0 commit comments