As a user I type following command into the java console:
!login <Username> <udpPort>
so, i.e.
!login Bob 2233
What I need is to easily get the values from this input:
String username = "Bob";
int port = 2233;
I am using a BufferedReader to get the input.
I already tried: But of course this is not working. But thats what I would like to have:
String [] input = in.readReadLine(); //ofcourse this is not working
Then I can easily assign the values:
String username = input[2]; //save "Bob"
int port = Integer.parseInt(input[3]); //save 2233
Any advices appreciated,
Dave
BufferedReaederreadLine() method returnString.Once you get String, you need to either
Split();(or)StringTokenizerto get as separate Strings.