Created
August 22, 2012 21:51
-
-
Save luismesas/3429720 to your computer and use it in GitHub Desktop.
NSString equation evaluator using NSExpression
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSString *equation = @"floor((19-10)/2)"; | |
NSNumber *result = [NSExpression expressionWithFormat:equation]; | |
NSLog(@"%@", result); // logs "4" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to do this in swift? ;)