String to math
I have a string " 10 + 10 + 10 " and want to calculate it. How can I do that?
7 Replies
How advanced do you want it to be?
And how much work are you willing to put into it?
It must not be advanced. My current usage is as simple as "10+10-10*10/10"
I mean how advanced do you want your code which does this to be?
Not advanced
There are existing projects for this kind of thing. For example:
https://github.com/codingseb/ExpressionEvaluator
GitHub
GitHub - codingseb/ExpressionEvaluator: A Simple Math and Pseudo C#...
A Simple Math and Pseudo C# Expression Evaluator in One C# File. Can also execute small C# like scripts - GitHub - codingseb/ExpressionEvaluator: A Simple Math and Pseudo C# Expression Evaluator in...
Then the easiest solution would probably just be to use a pre-made library
I will check out the Github. Thank you, you both