Well, as Bob pointed out the parsing subject is very big one. Also, what you need to do and what you need to show may not always the same ( thats when ad hoc hacking involves :) ) I'd like to give you an outline. First define your rules. Lets say your input is an "expression" then rules might be like:
expression: relational_expression .
relational_expression: a_expression .
relational_expression: a_expression relop a_expression .
a_expression: term .
a_expression: a_expression addop term .
term: factor .
term: term mulop factor .
factor: number .
factor:
factor:
addop:
mulop:
relop:
Note that here operator precedence is taken in to account thats why rule set is a little long. For instance, you do not want to evaluate "400<50" before "300-400" in "300-400<50".
I am not going into details of those rules, one might argue that this is too long, short, juicy or even squishy... Whatever, following those rules you see that first you need to locate comparison operator and evaluate left and right of it, rest is up to you. Note that above rules are just guideline not code.
System.Text.RegularExpressions[
^] namespace has all the tools you need to chop down input strings.