Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Command getCommand(String string){
- Explore explore = new Explore();
- String param;
- int length;
- //if its the command EXPLORE
- if(string.trim().toUpperCase().startsWith(commandList.get(9).getName())){
- //find the length of the command
- length=string.toUpperCase().length();
- //get the next substring after the command Eplore (to find out the paramater of the command)
- param = string.substring(length);
- //and set it as the parameter of EXPLORE command
- explore.setParams(param);
- return commandList.get(9);
- }
- for(int i=0;i<commandList.size();i++){
- if(string.trim().toUpperCase().startsWith(commandList.get(i).getName()))
- return commandList.get(i);
- }
- return null;
- }
Add Comment
Please, Sign In to add comment