public override IValue interpret(Context context) { ListValue list = (ListValue)getValue(context); IValue value = context.getValue("value"); int idx = list.IndexOf(value); if (idx < 0) { return(NullValue.Instance); } else { return(new IntegerValue(idx + 1)); } }
public int IndexOf(Field item) { switch (fieldType) { case FieldType.Array: return(ListValue.IndexOf(item)); case FieldType.String: switch (item.fieldType) { case FieldType.Integer: case FieldType.Float: case FieldType.String: return((objValue as string).IndexOf((string)item)); default: return(-1); } default: return(-1); } }