Hello I have a programme where you type in different commands. The only command I have at the moment is ping command. You type ping followed by your IP address.
example: ping 192.167.2.1
I want to get a result from this ping so I do this:
String ip = ""+l6+l7+l8+l9+l10+l11+l12+l13+l14+l15+l16;
String pingResult = "";
String pingCmd = "ping " + ip;
try {
Runtime r = Runtime.getRuntime();
Process p = r.exec(pingCmd);
BufferedReader in = new BufferedReader(new
InputStreamReader(p.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null) {
System.out.println(inputLine);
pingResult += inputLine;
}
in.close();
} catch (IOException e) {
System.out.println(e);
}
When I press a key the key value is stored in a string.
If l1 is equal to null, then the value gets stored in l1,
if l1 is not null and l2 is null then the next key that is pressed is stored in l2 and so on.
The maximum amount of keys you can press is 20. when you press enter all the strings are put together to form one big string. I want to be able to split that big string and take away the letters and leave the numbers. How can I do this.