How to convert a string to decimal when the string contains an arithmetic expression?
Such as,
string str ="((1024+34)-(8*56)";
Please suggest
The convert.todecimal won't work because of the presence of parenthesis(,)
Ex:-
string str = ((((@accijns+@ecotax)/100) * @unit) +@fostplus)
I am replacing @accijns, etc by property value
below is my code
string strFormula = oPriceType.formula;
string strCalculation = strFormula.Replace("@accijns", accijnValue.ToString()).Replace("@fostplus", fostplusValue.ToString()).Replace("@cost_price", @cost_price.ToString())
.Replace("@cost_extra", @cost_extra.ToString()).Replace("@cost_fob", @cost_fob.ToString()).Replace("@cost_ship", @cost_ship.ToString()).Replace("@cost_warehouse", @cost_warehouse.ToString())
.Replace("@ecotax", ecotaxValue.ToString()).Replace("@unit", @unit.ToString()).Replace("@discount_extra", @discount_extra.ToString()).Replace("@discount_payterm", @discount_payterm.ToString())
.Replace("@discount_financial", @discount_financial.ToString()).Replace("@weight", @weight.ToString()).Replace("@import_duty", @import_duty.ToString()).Replace("@degree", @degree.ToString())
.Replace("@recom_price", @recom_price.ToString());
have you got the idea now??
please suggest
thank you
sandeep