(ctx expr.EvalContext, vals []value.Value)
| 232 | return stripEval, nil |
| 233 | } |
| 234 | func stripEval(ctx expr.EvalContext, vals []value.Value) (value.Value, bool) { |
| 235 | |
| 236 | switch val := vals[0].(type) { |
| 237 | case value.StringValue: |
| 238 | sv := strings.Trim(val.ToString(), " \n\t\r") |
| 239 | return value.NewStringValue(sv), true |
| 240 | case value.StringsValue: |
| 241 | svs := make([]string, val.Len()) |
| 242 | for i, sv := range val.Val() { |
| 243 | svs[i] = strings.Trim(sv, " \n\t\r") |
| 244 | } |
| 245 | return value.NewStringsValue(svs), true |
| 246 | } |
| 247 | return nil, false |
| 248 | } |
| 249 | |
| 250 | // Replace a string(s). Replace occurences of 2nd arg In first with 3rd. |
| 251 | // 3rd arg "what to replace with" is optional |
nothing calls this directly
no test coverage detected