Dian found this code snippet.
String[] key_value = url.split("\\.");
for (int i=key_value.length; i>0; i--) {
if (i > 1)
domain = key_value[i-2]+"."+key_value[i-1];
break;
}
"I'm still not sure what this is supposed to do," Dian writes.
I believe this is someone's attempt to extract the TLD and primary domain from a URL, e.g. www.mysite.com
becomes mysite.com
. (Remember when www
s were on every domain name?) Why they chose to use a loop that only executes once, I'll never understand.