Why not put a character or space in between the command and parameter? That way you can utilize Java's Split function and do something like the below.
iTurtle.txt
Sample Java code
enum Commands {U, D, N, S, E, W};
String thought;
while ((thought = turtleBrain.readLine()) != null){
String[] instructions = thought.split("-");
Commands com = instructions[0];
switch (com) {
case U: Romina.setPenState("u"); break;
case D: Romina.setPenState("d"); break;
case N: Romina.moveNorth(instructions[1]); break;
case S: Romina.moveSouth(instructions[1]); break;
case E: Romina.moveEast(instructions[1]); break;
case W: Romina.moveWest(instructions[1]); break;
default: System.out.println("Invalid Command"); break;
}
}
Greetings.