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

Function runesIndexOf

diffmatchpatch/stringutil.go:59–71  ·  view source on GitHub ↗

runesIndexOf returns the index of pattern in target, starting at target[i].

(target, pattern []rune, i int)

Source from the content-addressed store, hash-verified

57
58// runesIndexOf returns the index of pattern in target, starting at target[i].
59func runesIndexOf(target, pattern []rune, i int) int {
60 if i > len(target)-1 {
61 return -1
62 }
63 if i <= 0 {
64 return runesIndex(target, pattern)
65 }
66 ind := runesIndex(target[i:], pattern)
67 if ind == -1 {
68 return -1
69 }
70 return ind + i
71}
72
73func runesEqual(r1, r2 []rune) bool {
74 if len(r1) != len(r2) {

Callers 2

TestRunesIndexOfFunction · 0.85
diffHalfMatchIMethod · 0.85

Calls 1

runesIndexFunction · 0.85

Tested by 1

TestRunesIndexOfFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…