For the next example:
User input sample: "1 + 3 - 2 * 4"
string input = Console.ReadLine();
string[] getElement = input.split(' ');
//So I can have
//getElement[0] = 1
//getElement[1] = +
//getElement[2] = 3
//...
//I have a "for()" cicle here and at one moment I have the following instruction:
if(getElement[i] == "+")
int add = Convert.ToInt32(getElement[i - 1]) + Convert.ToInt32(getElement[i + 1]);
//In this example it means: add = 1 + 3
My question is how I can remove positions [0],[1],[2]
of my string[]
getElement and replace them for "add" value?
I don't know how to use Replace()
in this case. Should I need to Resize Array? Need suggestions.