Delphi prepared by an analytic function of the FTP address

Author:Anonymous    Updated:2008-2-26 22:06:47
Procedure TForm1.FTPAnalysis (S: string; var UserName, Password, IP, FileName: String; var DirList: TStringList);
Var
   I, j: integer;
   StrAuthorization, strAddr, strDirFile: string; / / authorization information
Begin
   UserName: = 'anonymous';
   Password: = 'test@test.com';
   IP: ='';
   StrAddr: = Copy (S, 7, length (S) -6); / / ftp:// made after some
   / / S format is similar ftp://rec:ooo @ 192.168.76.11/20050418/abcdef.vox or ftp://192.168.76.11/ ......
   I: = Pos ('@', S);
   If (i> 0) then
   Begin
     StrAuthorization: = Copy (S, 7, i-7); / / only take account password field
     J: = Pos (':', strAuthorization);
     If (j <1) then
       Exit;
     UserName: = Copy (strAuthorization, 1, j-1);
     PassWord: = Copy (strAuthorization, j +1, length (strAuthorization)-j);
   End;
   I: = Pos ('@', strAddr);
   J: = Pos ('/', strAddr);
   If (j> 0) then
     IP: = Copy (strAddr, i +1, j-i-1) / / IP Address
   StrDirFile: = Copy (strAddr, j +1, length (strAddr)-j);
   DirList.Delimiter: = '/';
   DirList.DelimitedText: = strDirFile; / / Contents List
   FileName: = DirList [DirList.count-1]; / / for the last part of the file name
   DirList.Delete (DirList.Count-1);

End;
Previous:Using Delphi interesting animation of the mouse
Next:How is the thread sort of
User Reviews
Related Articles
Recommended article
AD