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

Function stringToIndex

diffmatchpatch/index.go:9–20  ·  view source on GitHub ↗

next invalid code point

(text string)

Source from the content-addressed store, hash-verified

7const runeMax = 0x110000 // next invalid code point
8
9func stringToIndex(text string) []index {
10 runes := []rune(text)
11 indexes := make([]index, len(runes))
12 for i, r := range runes {
13 if r < runeSkipEnd {
14 indexes[i] = index(r)
15 } else {
16 indexes[i] = index(r) - (runeSkipEnd - runeSkipStart)
17 }
18 }
19 return indexes
20}
21
22func indexesToString(indexes []index) string {
23 runes := make([]rune, len(indexes))

Callers 1

TestIndexConversionFunction · 0.85

Calls 1

indexTypeAlias · 0.85

Tested by 1

TestIndexConversionFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…