Jak jest:
http://mojhosting.ovh.pl/folder/folder/index.php
-> mojhosting.ovh.pl/folder/folder/index.php
Jak powinno:
http://mojhosting.ovh.pl/folder/folder/index.php
-> mojhosting.ovh.pl
function ExtractHostFromURL(URL: String): String;
begin
URL := LowerCase(URL);
if Copy(URL, 1, 7) = 'http://' then Delete(URL, 1, 7);
if Copy(URL, 1, 8) = 'https://' then Delete(URL, 1, 8);
if Pos(URL, '/') <> 0 then
Delete(URL, Pos(URL, '/'), Length(URL) - Pos(URL, '/'));
Result := URL;
end;
edit:
Czemu Pos(URL, '/')
zawsze zwróci zero, bez względu na to gdzie w URL
jest ukośnik?