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调用http接口上传文件

Delphi firedac在后台线程中从mssql server检索记录的方法

Delphi制作移动文字、图片

Delphi 的 webservice 的 cookie 操作

Delphi版本号检测判断

Delphi字符串中取数字

Delphi 判断文件名是否有效

Delphi与正则表达式

Delphi的控制台程式添加图标

Delphi取得桌面工作区域的大小

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



打赏

取消

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

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

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

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

评论

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