如何从字符串解析算术运算符? [英] How to parse arithmetic operators from string?

查看:134
本文介绍了如何从字符串解析算术运算符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以为int变量分配一个值,该值是用字符串编写的表达式的结果?例如.我有一个字符串"5-3",预期结果是2.

Is it possible to assign an int variable a value that is a result of expression written in a string? E.g. I have a string "5 - 3" and the expected result is 2.

推荐答案

您可以使用 查看全文

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