Dcnick96 gives good advice; a switch statement in Java can definitely help to cut down on code length and complexity. If you separate a String, or text message, into words, that should be much quicker and easier.
I wanted to clear up a bit of a misunderstanding that you seem to have, though- in Java (as well as a few other programming languages such as C++, I believe), it is in fact possible to use string input in an if-statement. If-then statements always contain a boolean value- simply put, a true or false. This allows a bit more flexibility than a switch-case statement, as you can actually ask a String, such as the text message, a few valuable things, such as if it contains another String.
For finding out what functions you can use with each class, like a String, [[the Javadoc]]
is probably the most useful resource that I've come across. To the left, you can see a bar containing every class in Java 7, including String; clicking on this link will give you a list of all of the functions. If you're using Java 6 or an earlier version, just Google 'javadoc 6' (or javadoc 5 or similar) and it should be the first link.[[This function]]
in particular should be useful for the function you described.
Hope this helped, and good luck!