MCPcopy Create free account
hub / github.com/araddon/qlbridge / replaceEval

Function replaceEval

expr/builtins/string.go:268–277  ·  view source on GitHub ↗
(ctx expr.EvalContext, vals []value.Value)

Source from the content-addressed store, hash-verified

266}
267
268func replaceEval(ctx expr.EvalContext, vals []value.Value) (value.Value, bool) {
269 val1 := vals[0].ToString()
270 arg := vals[1]
271 replaceWith := ""
272 if len(vals) == 3 {
273 replaceWith = vals[2].ToString()
274 }
275 val1 = strings.Replace(val1, arg.ToString(), replaceWith, -1)
276 return value.NewStringValue(val1), true
277}
278
279// Join items together (string concatenation)
280//

Callers

nothing calls this directly

Calls 2

NewStringValueFunction · 0.92
ToStringMethod · 0.65

Tested by

no test coverage detected