MCPcopy Create free account
hub / github.com/apache/answer / getRuneRange

Function getRuneRange

pkg/htmltext/htmltext.go:141–149  ·  view source on GitHub ↗

getRuneRange returns the valid begin and end indexes of the runeText

(runeText []rune, offset, limit int)

Source from the content-addressed store, hash-verified

139
140// getRuneRange returns the valid begin and end indexes of the runeText
141func getRuneRange(runeText []rune, offset, limit int) (begin, end int) {
142 runeLen := len(runeText)
143
144 limit = min(runeLen, max(0, limit))
145 begin = min(runeLen, max(0, offset))
146 end = min(runeLen, begin+limit)
147
148 return
149}
150
151// FetchRangedExcerpt returns a ranged excerpt from the HTML string.
152// Note: offset is a rune index, not a byte index

Callers 2

FetchRangedExcerptFunction · 0.85
TestGetRuneRangeFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestGetRuneRangeFunction · 0.68