This problem was not noticed before, it seems to remember to split the regular string, but not like the IP is "." To divide the regular character, but the other.
Today, the use of similar functions, code written well did not test, directly upload the server, but it will be error, after looking at the log is the IP partition part of the code in addition to the problem, and then find information on the Internet, find the information that the method is my current error this method, no language people out a small meeting, want to be able to use Then the method was found on the net, and then the partition identifier in the regular expression was transferred to the ".", and did not expect to split it,
But then notice that people's string delimiter is not the same, holding the heart to try, the word IP separator dot replace sing Woo it like the "\ \", and then debugging incredibly line,
Put the code below to take notes.
String ip= "160.18.214.211";
Ip=ip.replace (".", "\ \");
string[] Iparr = Ip.split ("[^\\d]+");
Java splits an IP address into an array