The given given fields are, price, currency and formula where I need to read the formula and replace where the price and currency will go into, example:
(((Price+12,9)+((Price+12,9)*0,05)+(((Price+12,9)+((Price+12,9)*0,05))*0,029)+0,45)*Currency)+(2*Currency)
So in order to make the above I am doing:
string formula = iFormula.Text.Replace("Price", price.ToString("n2")).Replace("Currency", currency.ToString("n2"));
Since I want to make sure price and currency are correctly formatted, they are prior to replacement parsed into decimals.
Now here is where I am having problem with, how can I confirm that the formula is valid, and get the result of it ?
Is there a library that evaluate and compute the formula ?