I have a menu, where the user enters a command followed by a argument, ex:
add 5 // adds 5
sub 7 // sub
in x 8 // inserts x into the 8 th spot

Right now I am tokenizing the string, looking at the first token to determine what function to use and using the following tokens as arguments to pass.

Is there a better way to do this?

PS. In PHP I did the same using regular expressions.