I am trying to turn this from java to C# and have done almost all of it except the tokenizer. I know that you use split in C# but I cannot seem to figure it out. The program needs to split up the equation that the user enters (4/5 + 3/4) is the format without the parenthesis. Any help would be great.
// read in values for object 3
Console.Write("Enter the expression (like 2/3 + 3/4 or 3 - 1/2): ");
string line = Console.ReadLine();
// Works with positives and neagative values!
// Split equation into first number/fraction, operator, second number/fraction
StringTokenizer st = new StringTokenizer(line, " ");
string first = st.nextToken();
char op = (st.nextToken()).charAt(0);
string second = st.nextToken();
I will need the symobol (+, -, *, or /) later and need to check to see whether it is a whole number which I do right after this in my code. Below is kind of what I have tried but I am stuck with the char.
char delimeters = ' ';
string[] tokens = line.Split(delimeters);
string first = tokens[0];
char c = tokens[1]