I want to evaluate an a string math expression , so before i want to extract variables so i have to remove all special characters my code only can remove a special character like `a+b*c` and the result i get is `a=;b=;c=`, now if i write two successive special characters like `(a+b)*c` and `a++b` results will be `=;a=;b=;c=` and `a=;=;b=` always there is a sign `=;` added for no reasons so how to get rid of them because after that i will use mathematic functions so that will be a real problem for me please help me ! here is my code
Do you mean except the arithmetic operators (+,-,*./) and operands it will take out everything from the given string? To add more to this are you looking for bodmas evaluation?
No i mean if i want to type two splits like `a++b` i want the output Always look like `a=;b= ` but my output is `a=;=;b=` why?? i have a mistake in my code!
The output you are getting seems to because of any array element is a space. for a++b the length should be 2. Print the length of that array and see what length are you getting.
Yes i put a condition if variable[j]=="" and it works now , thank you all for help , i want to ask now another question if someone can answer me i'll be happy , i want to add a func_var which remove strings like 'cos' or 'sin' or 'tan' from string expression , did someone have an idea how to do that ?
To be honest I am mainly into java and don't know much about c#. But the logic should be somewhat like search for the position of the string and remove from there till the length of the string.