programatically extract the file name from a Download Link using delphi -
How can I remove the file name from the download link using Delphi?
Example
http://pj-mirror01.mozilla.org/pub/mozilla.org/firefox/releases/3.6/win32/es-CL/Firefox%20Setup%203.6.exe
Firefox Setup 3.6.exe
Try it
Function GetURLFilename (file type: string; constant delimiter: string = '/'): string; Var I: integer; I start: = LastDelimiter (Delimiter, FILEPATH); Result: = Copy (FILEPATH, I + 1, MaxInt); Results: = UrlDecode (Results); End;
The URL was copied to the code and it looks
function URL code (Cont. Encoded STR: string): string; Var I: integer; Start the result: = ''; If Length (encoded STR) & gt; 0 Then I start: = 1; While I & lt; = Length (encoded STR) starts when encoded STR [I] = '%' then the result starts: = result + crow (hexteoin (encoded STR [I + 1] + encoded SRR [I + 2])) ; I: = Succ (Succ (I)); And end and if encoded STR [I] = '+' then result: = result + '' and result: = result + encoded SRR [I]; I: = Succ (I); End; End; End; Function HexTown (Hexstrrast: String): Int 64; Var RetVar: Int64; I: byte; Start hexstrate: = uppercase (hexster); If hexster [length (hexster)] = 'h' remove (hexसेट, height (hexster), 1); RetVar: = 0; For: = 1 length (hexacrat) starts with RetVar: = RetVar shl 4; If the hexster [i] ['0' .. '9'] then RetVar: = RetVar + (byte (hexast [i]) - 48) and if hexast [i] ['A' .. 'F'] Then RetVar: = RetVar + (byte (hexstrat [i]) - 55) start again: = 0; break; End; End; Result: = Rateer; End;
Comments
Post a Comment