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

Function joinValSeparator

ext/strings.go:801–816  ·  view source on GitHub ↗
(strs traits.Lister, separator string)

Source from the content-addressed store, hash-verified

799}
800
801func joinValSeparator(strs traits.Lister, separator string) (string, error) {
802 sz := strs.Size().(types.Int)
803 var sb strings.Builder
804 for i := types.Int(0); i < sz; i++ {
805 if i != 0 {
806 sb.WriteString(separator)
807 }
808 elem := strs.Get(i)
809 str, ok := elem.(types.String)
810 if !ok {
811 return "", fmt.Errorf("join: invalid input: %v", elem)
812 }
813 sb.WriteString(string(str))
814 }
815 return sb.String(), nil
816}
817
818// quote implements a string quoting function. The string will be wrapped in
819// double quotes, and all valid CEL escape sequences will be escaped to show up

Callers 1

CompileOptionsMethod · 0.85

Calls 4

IntTypeAlias · 0.92
SizeMethod · 0.65
GetMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected