You need to use String function / method to compare them, not just "==" or "!=" .
Rubbish. The String class overloads the == and != operators. The method of comparing Strings is perfectly acceptable.
OP: What is sending the strings to the Arduino? If you are using the Serial Monitor, what line ending do you have? The trim() method might prove useful.