1.소개 : URL(http://www.daum.net/test/test.html)에서 Domain(daum.net)을 분리하는 함수.
Indy의 TIdURI를 사용하면 쉽게 구현됨

2.소스 :
function ParseDomain(url:String):String;
var
  domain,host: String;
  len,pos1 : integer;
  IdURI : TIdURI;
begin
  pos1 := Pos('http://',url);
  if pos1 = 0 then
    url := 'http://' + url;

  IdURI := TIdURI.Create(url);

  host := IdURI.Host;
  pos1 := Pos('.',host)+1;
  len := StrLen(PChar(host));
  domain := MidStr(host,pos1,len-pos1+1);

  if IdURI <> nil then
      IdURI.Free;

  Result := domain;
end;
Posted by Gu Youn
,