I have a TextBox where a user can enter a calculation, such as 100+200
on his keyboard.
How can I break the string into three parts, like:
string mySum = "200+800"; //Just and example of what he may enter into the textbox
int Operator = mySum.IndexOf('+');
string TheOperator = "+";
string part1 = (mySum.Substring(1, Operator - 1));
mySum.Remove(int.Parse(part1), Operator);
string part2 = (mySum);
//Calculate
int Answer = int.Parse(part1) + TheOperator + int.Parse(part2);
Messagebox.Show(Asnwer.toString()); //Message box should display 1000
Firstly I know this is wrong, but I am highly unsure how to do this. Ive looked everywhere but I can't find anything related directly to this