MCPcopy Create free account
hub / github.com/sergi/go-diff / runesIndex

Function runesIndex

diffmatchpatch/stringutil.go:86–94  ·  view source on GitHub ↗

runesIndex is the equivalent of strings.Index for rune slices.

(r1, r2 []rune)

Source from the content-addressed store, hash-verified

84
85// runesIndex is the equivalent of strings.Index for rune slices.
86func runesIndex(r1, r2 []rune) int {
87 last := len(r1) - len(r2)
88 for i := 0; i <= last; i++ {
89 if runesEqual(r1[i:i+len(r2)], r2) {
90 return i
91 }
92 }
93 return -1
94}
95
96func intArrayToString(ns []index) string {
97 if len(ns) == 0 {

Callers 2

runesIndexOfFunction · 0.85
diffComputeMethod · 0.85

Calls 1

runesEqualFunction · 0.85

Tested by

no test coverage detected