delphi有用的函数ExtractFileName、ExtractFilePath


本文整理自网络,侵删。

 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注入下载者源代码

Delphi xe6 利用fastmm4检测内存泄漏

Delphi代码变异加密工具

Delphi调用cmd并取得输出字符

Delphi模拟点击网页中的按钮

Delphi tnethttpcleint提交json串

Delphi gettempdirectory 获取临时文件夹路径

Delphi 通过注册表获取系统版本和cpu型号

Delphi之format函数

Delphi 正则表达式校验手机号

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...