Ejemplo n.º 1
0
        private ExpressionResponse ParseMDASExpression(string expression, char arithmeticOperator, int?precision)
        {
            var strArray = expression.Split(arithmeticOperator);
            var result   = ArithmeticOperations.EvaluateMDAS(strArray[0], arithmeticOperator, strArray[1]);

            if (result != null)
            {
                return(new ExpressionResponse()
                {
                    error = null, result = new List <string>()
                    {
                        result.ToString()
                    }
                });
            }
            else
            {
                return(new ExpressionResponse()
                {
                    error = $"There was an error evaluating the expression - {expression}", result = null
                });
            }
        }