i found this cool PHP function to extract the URL name from a url string. Now i would like to recreate the same function in Objective-C code. I'm still trying but without success... Can someone help me recreate this function?
Here is the PHP code:
function __extractName($url)
{
$domain = parse_url($url , PHP_URL_HOST);
if (preg_match('/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i', $domain, $list)) {
return substr($list['domain'], 0,strpos($list['domain'], "."));
}
return false;
}