Skip to content

Instantly share code, notes, and snippets.

@luismesas
Created August 22, 2012 21:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luismesas/3429720 to your computer and use it in GitHub Desktop.
Save luismesas/3429720 to your computer and use it in GitHub Desktop.
NSString equation evaluator using NSExpression
NSString *equation = @"floor((19-10)/2)";
NSNumber *result = [NSExpression expressionWithFormat:equation];
NSLog(@"%@", result); // logs "4"
@masters3d
Copy link

How to do this in swift? ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment