I want to program a scientific calculator, and in order to simplify the code and make multiple operations at one, I need to perform operations using a single text box string.
For example, the textbox has the text "5+5", when I press "=" the number "10" appears.
I was able to do that for the SUM operation:
var allNumbersAddedUp = numbersText.Split('+').Select(double.Parse).Sum();
What i was wondering now, is how to do the same thing for MULTIPLICATION, DIVISION, and SUBTRACTION.
Is there a way to convert the entire string to a number? let's say, if I insert "1+(2*3)" into the textbox, how can I get "7" to appear?
Thanks in advance!