MCPcopy Create free account
hub / github.com/cel-expr/cel-go / substrRange

Function substrRange

ext/strings.go:755–768  ·  view source on GitHub ↗
(str string, start, end int64)

Source from the content-addressed store, hash-verified

753}
754
755func substrRange(str string, start, end int64) (string, error) {
756 runes := []rune(str)
757 l := len(runes)
758 if start > end {
759 return "", fmt.Errorf("invalid substring range. start: %d, end: %d", start, end)
760 }
761 if int(start) < 0 || int(start) > l {
762 return "", fmt.Errorf("index out of range: %d", start)
763 }
764 if int(end) < 0 || int(end) > l {
765 return "", fmt.Errorf("index out of range: %d", end)
766 }
767 return string(runes[int(start):int(end)]), nil
768}
769
770func trimSpace(str string) (string, error) {
771 return strings.TrimSpace(str), nil

Callers 1

CompileOptionsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected