Closed Sam1999 closed 10 years ago
By default, %
is interpreted as the modulo operator. In order for it to be interpreted as the percentage operator, you need to flip the DDMathOperatorSet.interpretsPercentSignAsModulo
property to be NO
. The easiest way to do that is on the default operator set:
[DDMathOperatorSet defaultOperatorSet].interpretsPercentSignAsModulo = NO;
I'm trying to use the
numberByEvaluatingString
method to return results.An example calculation:
100 * 10%
The expected result is 10
But it throws an error "no right operand to binary %"
Am I missing something or is there another way to perform these calculations?