我目前正在制作一个计算器。我知道如何编写逻辑,但我很好奇是否可以按照我要解释的方式来完成。
String str = "12 + 43 * (12 / 2)";
int answer;
answer = str.magic();
//str.magic is the same as
answer = 12 + 43 * (12 / 2);
Run Code Online (Sandbox Code Playgroud)
现在我想要的是如何将 str 转换为可执行代码。
c# ×1