First of all: If you do this, the condition string condition ="25<10" will be 25 <10, not true or flase! If 25, 10 and <from your xml paste them into 3 different lines, such as x, y and z, and compare them like:
string input = "25<10"; //input form your xml int operatorPosition; //get the position of the operator if(input.contains("<")){ operatorPosition = input.IndexOf("<"); }else{ operatorPosition = input.IndexOf(">"); } //maybe i messed up some -1 or +1 here but this should work this string x = input.Substring(0,operatorPosition-1); string y = input.Substring(operatorPosition+1, input.length-1); string z = input.charAt(operatorPosition); //check if it is < or > if(z.equals("<"){ //compare x and y with < if(Int32.parse(x) < Int32.parse(y)){ //do something }else{ //do something } } //z does not equal < so it have to be > (if you dont have something like = otherwise you need to check this too) else{ if(Int32.parse(x) < Int32.parse(y)){ //do something }else{ //do something }
There may be a better way to convert a clean string input to an if clause, but I would do it.
source share