假设url是不固定的
有可能是
http://192.168.1.100/111/11.rar
http://192.168.1.100/222/22/22.rar
http://192.168.1.100/333/333/333/333/333/33/33/33.rar
怎么能用一个函数来固定的能够提取到比如11.rar/22.rar/33.rar文件名对delphi不太熟悉
我想的是先替换http://之后在从右往左减去/之前的内容一个一个减最后替换掉/就是了但是不知道具体该怎么写
谁能帮助一下,在线等待。

解决方案 »

  1.   

    道理我也明白
    但是怎么具体写能不能告诉我
    我不太熟悉delphi的语法
      

  2.   

    function TForm1.funGetCurrentDir(const str: string): string;
    var i: integer;
    begin
      for i := length(str) - 1 downto 0 do
      begin
        if str[i] = '\' then
          break;
      end;
      Result := copy(str, 0, i - 1);
    end;
      

  3.   

    转换函数
    function convert(input:string):string;
    var
    i:integer;
    c:pchar;
    begin
    c:=pchar(input);
    for i:=length(input) downto 0 do begin
    if c[i]='/' then break;
    end;
    convert:=copy(input,i+2,length(input));
    end;
      

  4.   

    Delphi syntax:function LastDelimiter(const Delimiters, S: string): Integer;DescriptionCall LastDelimiter to locate the last delimiter in a specified string.Delimiters is a string where each character is a valid delimiter.S is the string to search for delimiters.For example, the line MyIndex := LastDelimiter('\.:','c:\filename.ext'); // Delphi MyIndex = LastDelimiter("\\.:","c:\\filename.ext"); // C++sets MyIndex to 12.When working with multi-byte character sets (MBCS), S may contain double byte characters, but the delimiters listed in the Delimiters parameter must all be single byte non-null characters.