mainunit.pas
上传用户:psxgmh
上传日期:2013-04-08
资源大小:15112k
文件大小:2k
- unit mainunit;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, StdCtrls, Buttons;
- type
- TForm1 = class(TForm)
- Label1: TLabel;
- Edit1: TEdit;
- GroupBox1: TGroupBox;
- BitBtn1: TBitBtn;
- Label2: TLabel;
- Label7: TLabel;
- Label4: TLabel;
- Edit2: TEdit;
- Edit5: TEdit;
- Label3: TLabel;
- Label5: TLabel;
- Edit3: TEdit;
- Label6: TLabel;
- Edit4: TEdit;
- procedure BitBtn1Click(Sender: TObject);
- private
- { Private declarations }
- public
- procedure UrlSplit(UrlStr:String);
- { Public declarations }
- end;
- var
- Form1: TForm1;
- implementation
- {$R *.dfm}
- procedure TForm1.UrlSplit(UrlStr:String);
- var
- TempStr,UserPwdStr:String;
- Ptn:Integer;
- begin
- TempStr:=LowerCase(UrlStr);
- if (Pos('http',TempStr)=1) then
- begin
- Label3.Caption:='Http协议类型';
- Label5.Enabled:=False;
- Label6.Enabled:=False;
- Edit3.Enabled:=False;
- Edit4.Enabled:=False;
- Delete(TempStr,1,7);
- Edit5.Text:=TempStr;
- end
- else if (Pos('ftp',TempStr)=1)then
- begin
- Delete(TempStr,1,6);
- if (Pos(':',TempStr)<>0) then
- begin
- Label3.Caption:='Ftp协议密码用户登录类型';
- Ptn:=Pos('@',TempStr);
- UserPwdStr:=Copy(TempStr,1,Ptn-1);
- Delete(TempStr,1,Ptn);
- Label5.Enabled:=True;
- Label6.Enabled:=True;
- Edit3.Enabled:=True;
- Edit4.Enabled:=True;
- Ptn:=Pos(':',UserPwdStr);
- Edit3.Text:=Copy(UserPwdStr,1,Ptn-1);
- Delete(UserPwdStr,1,Ptn);
- Edit4.Text:=UserPwdStr;
- Edit5.Text:=TempStr;
- end
- else
- begin
- Label3.Caption:='Ftp协议匿名登录类型';
- Label5.Enabled:=False;
- Label6.Enabled:=False;
- Edit3.Enabled:=False;
- Edit4.Enabled:=False;
- Edit5.Text:=TempStr;
- end;
- end
- else
- begin
- ShowMessage('该URL地址不合法,请重新输入!');
- Edit1.SetFocus;
- Edit1.SelectAll;
- Exit;
- end;
- While (Pos('/',TempStr)<>0 ) do
- begin
- Ptn:=Pos('/',TempStr);
- Delete(TempStr,1,Ptn);
- end;
- Edit2.Text:=TempStr;
- end;
- procedure TForm1.BitBtn1Click(Sender: TObject);
- begin
- if Edit1.Text<>'' then
- UrlSplit(Edit1.Text);
- end;
- end.