- 人气:
- 放大
- 缩小
- 二维码
- 赞赏
delphi 获取\xxx\xxxx\1234最后一级名称
function GetLastName(const fn: string): string;
var
i:Integer;
s:string;
begin
s := trim(fn);
if s[Length(s)]='\' then
s := Copy(s,1,Length(s)-1);
while Pos('\',s)>0 do
begin
i := Pos('\',s);
s := Copy(s,i+1,Length(s)-i);
end;
Result := s;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
str:string;
begin
caption := GetLastName('\sfsdf\sdfsdfs\电影名称');
end;