本文介绍了评估串数学EX pression? (的NSString)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:结果
  

我有一个的NSString从而重新presents计算如。 @(10 + 10)* 2我要评估字符串,就好像它实际上是这样的;

I have a NSString which represents a calculation eg. @"(10+10)*2" and I want to evaluate the string as if it was actually something like this;

double result = (10+10)*2;

什么是走在iOS中最直接的方法?

What is the most straightforward approach to take in iOS?

推荐答案

看看戴夫德隆的 DDMathParser框架

这篇关于评估串数学EX pression? (的NSString)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!