0

I have to evaluate the following value in NSExpression.Please help me.

let calculateExpression = NSExpression(format: "6(9*9)")
    if let calculateConvertedValue = calculateExpression.expressionValueWithObject(nil, context: nil) as? NSNumber {
         outputValue = calculateConvertedValue.stringValue
        print("Output",outputValue)

    }
Mukesh N
  • 71
  • 1
  • 8
  • 1
    Simple answer: You can't. NSExpression is pretty limited in its syntax. Use a proper math parser, for example https://github.com/davedelong/DDMathParser. – Martin R Jul 13 '16 at 11:11
  • @MartinR How to use DDMathParser. Can you give me the sample? – Mukesh N Jul 14 '16 at 04:17

0 Answers0