getRuneRange returns the valid begin and end indexes of the runeText
(runeText []rune, offset, limit int)
| 139 | |
| 140 | // getRuneRange returns the valid begin and end indexes of the runeText |
| 141 | func 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 |
no outgoing calls