string strEq="-517*13+522*(312)-234*(34)+71";
StringBuilder sbModifiedExp = new StringBuilder(strEq);
object result = new DataTable().Compute(string.Format(sbModifiedExp.ToString()), "");
double dCalcValue = Convert.ToDouble(result) > 0 ? Convert.ToDouble(result) : 0;
No comments:
Post a Comment