(ctx expr.EvalContext, vals []value.Value)
| 156 | return stringIndexEval, nil |
| 157 | } |
| 158 | func stringIndexEval(ctx expr.EvalContext, vals []value.Value) (value.Value, bool) { |
| 159 | if vals[0] == nil || vals[0].Err() || vals[0].Nil() { |
| 160 | return nil, false |
| 161 | } |
| 162 | retVal := strings.Index(vals[0].ToString(), vals[1].ToString()) |
| 163 | if retVal >= 0 { |
| 164 | return value.NewIntValue(int64(retVal)), true |
| 165 | } |
| 166 | |
| 167 | return nil, false |
| 168 | } |
| 169 | |
| 170 | // SubString from a given string, use integers to describe the start, [stop] |
| 171 | // of substring to extract. |
nothing calls this directly
no test coverage detected