MCPcopy Create free account
hub / github.com/brimdata/super / Call

Method Call

runtime/vam/expr/function/string.go:237–251  ·  view source on GitHub ↗
(args ...vector.Any)

Source from the content-addressed store, hash-verified

235}
236
237func (t *Trim) Call(args ...vector.Any) vector.Any {
238 if vec, ok := expr.CheckForNullThenError(args); ok {
239 return vec
240 }
241 val := vector.Under(args[0])
242 if val.Type() != super.TypeString {
243 return vector.NewWrappedError(t.sctx, "trim: string arg required", val)
244 }
245 out := vector.NewStringEmpty(val.Len())
246 for i := uint32(0); i < val.Len(); i++ {
247 s := vector.StringValue(val, i)
248 out.Append(strings.TrimSpace(s))
249 }
250 return out
251}

Callers

nothing calls this directly

Calls 8

CheckForNullThenErrorFunction · 0.92
UnderFunction · 0.92
NewWrappedErrorFunction · 0.92
NewStringEmptyFunction · 0.92
StringValueFunction · 0.92
TypeMethod · 0.65
LenMethod · 0.65
AppendMethod · 0.45

Tested by

no test coverage detected