uses System.StrUtils;
//获取主站地址;
function getSite(url:string):string;
var
dir,s:string;
p:integer;
begin
s:=url;
p:=pos('/',s);
if(p<=0)then begin result:=url;exit;end;
dir:=leftstr(s,p-1);
if(dir='http:')then s:=rightstr(s,length(s)-7);
if(dir='https:')then s:=rightstr(s,length(s)-8);
p:=pos('/',s);
if(p<=0)then begin result:=url;exit;end;
s:=leftstr(s,p-1);
result:=s;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
//用法
text:=getSite('http://www.delphiw.com/show/?id=NjgxNA==');
end;
Copyright © 2014 DelphiW.com 开发 源码 文档 技巧 All Rights Reserved
晋ICP备14006235号-8 晋公网安备 14108102000087号
执行时间: 0.066683053970337 seconds