I want to extract the IP address from the following String:
106.220.155.36 - - [29/Sep/2015:09:51:52 -0400] "GET /tutorial/grammar/LL/images/llparsetable.png HTTP/1.1" 200 14284
To do this, I decided to read the string one character at a time. I tried the following code:
public static String uniqueIP(String line){
String IP = "";
while(line.next() != " "){
IP = IP + line.next();
}
return IP;
}
However, the next method doesn't work. Is there some other method I can use?