评估中字符串的数学EX pression [英] Evaluate mathematical expression within string

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

问题描述

我开发一个Android应用程序,我得到的数学EX pression我要计算一个字符串,我这样做是为了将字母转换成我需要的数字,但什么是评价最好的办法?

I'm developing an Android app that i get an String with the mathematical expression i have to calculate, i did it to convert the letters into the numbers i need, but what is the best way to evaluate this?

没有什么太复杂的公式像: ((A * 2 + B * 3 + C * 5)/ 10)+ D

Nothing too complicated, the formulas are like those: ((A * 2 + B * 3 + C * 5) / 10) + D

编辑: 刚刚发现的家伙,非常简单的API,就像一个魅力 HTTP://$c$c.google.com/p / symja /维基/ MathEx pressionParser

Just found that guy, very simple API, works like a charm http://code.google.com/p/symja/wiki/MathExpressionParser

推荐答案

您需要某种数学分析器

玩转推出自己的,还是有很多关于谷歌的点击率:<一href="https://www.google.co.uk/#hl=en&gs_nf=1&cp=16&gs_id=7&xhr=t&q=java+math+parser" rel="nofollow">https://www.google.co.uk/#hl=en&gs_nf=1&cp=16&gs_id=7&xhr=t&q=java+math+parser

Fun to roll your own, or there are plenty of hits on google: https://www.google.co.uk/#hl=en&gs_nf=1&cp=16&gs_id=7&xhr=t&q=java+math+parser

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆