本文整理自网络,侵删。
function ExtractFileName(const FileName: string): string; // 解出文件名
function ExtractFilePath(const FileName: string): string; // 解出文件路径
function ExtractFileName(const FileName: string): string;
var
P: Integer;
begin
P := Length(FileName);
while (P > 0) and (FileName[P] <> '\') and (FileName[P] <> ':') do Dec(P);
Result := Copy(FileName, P + 1, Length(FileName) - P);
end;
function ExtractFilePath(const FileName: string): string;
var
P: Integer;
begin
P := Length(FileName);
while (P > 0) and (FileName[P] <> '\') and (FileName[P] <> ':') do Dec(P);
Result := Copy(FileName, 1, P);
end;
相关阅读 >>
Delphi firedac在后台线程中从mssql server检索记录的方法
Delphi 的 webservice 的 cookie 操作
更多相关阅读请进入《Delphi》频道 >>