var str:string;
int:integer;
begin
str:='http://www.csdn.net';
if copy(str,1,pos('/',str))='http:' then showmessage('HTTP协议');
str:='ftp://www.csdn.net';
if copy(str,1,pos('/',str))='ftp:' then showmessage('FTP协议');
end;
int:integer;
begin
str:='http://www.csdn.net';
if copy(str,1,pos('/',str))='http:' then showmessage('HTTP协议');
str:='ftp://www.csdn.net';
if copy(str,1,pos('/',str))='ftp:' then showmessage('FTP协议');
end;
若返回为0,表示没有找到
你觉得下面的有什么问题吗,怎么运行时点击没有反应呀
procedure TForm1.Button1Click(Sender: TObject);
var str:string;
begin
str:=edit1.Text;
if copy(str,1,pos('/',str))='http:' then showmessage('HTTP协议'); if copy(str,1,pos('/',str))='ftp:' then showmessage('FTP协议');
end;