Delphi Drawers

パスからファイル名を取得

ファイルパスからファイル名のみを抽出します。

function fnGetFileNameByFilePath(strPath:string):string;
begin
  strPath := StringReplace(strPath, '/', '\', [rfReplaceAll]);
  while pos('\',strPath) > 0 do begin
    strPath := copy(strPath, pos('\',strPath) + 1,length(strPath) - pos('\',strPath));
  end;
  fnGetFileNameByFilePath := strPath;
end;
Copyright © 2006 Hikijishi All Rights Reserved.
[] [delphi][0.00206995010375977]