I want to implement a code which checks ip into array. I tried this:
// 123.11.1.1, 123.1.1.12, 123.322.12.1
String[] list = merchant.getAllowed_ip_address().split(",");
String ip = request.getRemoteAddr();
for (ip : list.split(",")) {
if (!ip.trim().equals(request.getRemoteAddr().trim()))
{
// Not in list
}
}
But I get Cannot invoke split(String) on the array type String[]. Do you know how I can fix this?
spliton the each item from the array