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;

解决方案 »

  1.   

    能具体说明一下copy(str,1,pos('/',str))这个吗?
      

  2.   

    在str这个字符串中找'/'的位置
    若返回为0,表示没有找到
      

  3.   

    TO  eulb(执子之手,与子偕老) :
    你觉得下面的有什么问题吗,怎么运行时点击没有反应呀
    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;