I haven the NSString @"200 * (1 + (5 / 100))"
,
when I put it into a NSExpression *expression = [NSExpression expressionWithFormat:myString];
and NSLog
expression
I it returns the string.
When I however call [[expression expressionValueWithObject:nil context:nil] doubleValue]
I get a result of 200
.
Can NSExpression
not handle two sets of parenthesis? Is the another solution with using NSExpression
- I don't want to use any of the MathLibraries, because I just have very simple math equations.
Thanks