Dynamic statements / simple parser (VB.NET)
-
I'm writing an Windows Forms VB.NET application where the user can type in some kind of compare evaluator. Example : {cost} > 10000 and {itemgroup} = 'A01' My app. will take the entered text and evaluate it against in-memory data. The values tags ( {cost}, {itemgroup}, etc.) are replaced with the proper values by my app before evaluation/parsing... so my question is : Is there a simple way of parsing or evaluating a dynamic statement in a string ? Something what would work like this : dim strStatement as string = " 780 > 10000 and 'B54' = 'A01' " if EvaluateStatement(strStatement) then ' Do some stuff.. else ' Do some other stuff.. end if Do I need to code my own evaluator from scratch or is there a shortcut or code I can use... maybe a 3rd party control ? Any advice ? TIA :)