给你个例子
function TForm3.GetName(FileName: string): string;
var
I: Integer;
iPos1, iPos2: Integer;
iCount: Integer;
begin
//
iPos1 := 0;
iPos2 := 0;
for I := 1 to Length(FileName) do
begin
if FileName = '/' then iPos1 := I;
if FileName = '.' then iPos2 := I;
end;
iCount := iPos2 - iPos1 - 1;
Result := Copy(FileName,iPos1+1,iCount);
end;