用什么函数可从文件名340121790926373.jpg提取到340121790926373字符串?急用!!

解决方案 »

  1.   

    你用
    copy('340121790926373.jpg',0,pos('.','340121790926373.jpg'));就好了
      

  2.   

    function CopyStrLeft(ch: Char; str: string): string;
    begin
      Result:= Copy(str, 1, Pos(ch, str)-1)
    end;function CopyStrRight(ch: Char; str: string): string;
    begin
      Result:= Copy(str, Pos(ch, str)+1, Length(str)-Pos(Ch, str)+1)
    end;
      

  3.   

    var str:string;
    begin
        str:='340121790926373.jpg';
        showmessage(Copy(Str,1,Pos(ExtractFileExt(str),Str) - 1));
    end;
      

  4.   

    var
     sRes,str: string;str := '340121790926373.jpg'; 
    sRes := copy(str,1,pos('.',str) -1 );
      

  5.   

    showmessage(copy('340121790926373.jpg',0,pos('.','340121790926373.jpg')-1));
      

  6.   

    to jacket008(夜猫)
    应该是从1开始的啊,是DELPHI啊
    copy('340121790926373.jpg',1,pos('.','340121790926373.jpg')-1)
    或者
    copy('340121790926373.jpg',1,length('340121790926373.jpg') - 4)
      

  7.   

    s:='340121790926373.jpg';
    i:=Pos('.',s);
    delete(s,i,Length(s)-i+1)
      

  8.   

    s:='340121790926373.jpg';
    i:=Pos('.',s);
    delete(s,i,Length(s)-i+1)
      

  9.   

    字符串中取数字,
    function findNUM(s:string):string;
    begin
    begin
          date:=' ';
        for i:=1 to length(s) do
        begin  if (s[i]>='0')and(s[i]<='9')
        then
               date:=date+s[i];
    end;
    end;
      

  10.   

    同意,你首先取得文件名,然后通过 . 来pos 左便的 文件名,不要后缀名就行了
      

  11.   

    用lincanwen(密码错误)的吧,其他人有误导之嫌。
      

  12.   

    function retuFileName(const FileName: string): string;
    var
      I: Integer;
    begin
      I := LastDelimiter(PathDelim + DriveDelim, FileName);
      Result := Copy(FileName, 1, MaxInt-i-1);
    end;
      

  13.   

    不好意思?上面的写错了。如下
    function retuFileName(const FileName: string): string;
    var
      I: Integer;
    begin
      I := LastDelimiter('.', FileName);
      Result := Copy(FileName, 1, i-1);end;
      

  14.   

    你用
    copy('340121790926373.jpg',0,pos('.','340121790926373.jpg')-1);就好了
      

  15.   

    copy('340121790926373.jpg',0,pos('.','340121790926373.jpg'))
      

  16.   

    delphi里有专门的函数好象是extractfilename,记不清了,你可以查一下RTL手册一类的东西。我没有电脑现在不能帮你查。
      

  17.   

    ChangeFileExt(ExtractFileName('340121790926373.jpg'),'')