ExtractNewFolderPath
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
HtmlFileName: string; // "D:\C++Builder学习大全中文版\index.htm"
_filesFolder: string; // "D:\C++Builder学习大全中文版\"
_filesFolderName: string; // "index_files"
_filesFolderPath: string; // "D:\C++Builder学习大全中文版\index_files"
begin
HtmlFileName := 'D:\C++Builder学习大全中文版\index.htm';
_filesFolder := ExtractFilePath(HtmlFileName);
_filesFolderName := ChangeFileExt(ExtractFileName(HtmlFileName), '') +
'_files'; // INDEX_files
_filesFolderPath := _filesFolder + _filesFolderName;
Memo1.lines.Add(_filesFolderPath);
end;
{
// "D:\C++Builder学习大全中文版\index.htm"
// "D:\C++Builder学习大全中文版\"
// "index_files"
// "D:\C++Builder学习大全中文版\index_files"
Caption:=ExtractNewFolderPath('D:\C++Builder学习大全中文版\index.htm','_files');
"D:\C++Builder学习大全中文版\index_files"
}
function ExtractNewFolderPath(FileName: string; NewText: string): string;
var
_filesFolder: string; // "D:\C++Builder学习大全中文版\"
_filesFolderName: string; // "index_files"
_filesFolderPath: String;
begin
_filesFolder := ExtractFilePath(FileName);
_filesFolderName := ChangeFileExt(ExtractFileName(FileName), '') + NewText;
_filesFolderPath := _filesFolder + _filesFolderName;
Result := _filesFolderPath;
end;
// if not DirectoryExists(_filesFolderPath) then
// CreateDir(_filesFolderPath);
procedure TForm1.Button2Click(Sender: TObject);
var
s, s1, s2: string;
begin
s := 'D:\C++Builder学习大全中文版\index.htm';
s1:=ExtractNewFolderPath(s,'_files');
s2 := ExtractNewFolderPath(s, '_AttachMents');
Memo1.lines.Add(s);
Memo1.Lines.Add(s1);
Memo1.lines.Add(s2);
end;
end.

附件列表
ExtractNewFolderPath的更多相关文章
随机推荐
- 2、Python djang 框架下的word Excel TXT Image 等文件的下载
2.python实现文件下载 (1)方法一.直接用a标签的href+数据库中文件地址,即可下载.缺点:word excel是直接弹框下载,对于image txt 等文件的下载方式是直接在新页面打开. ...
- 移动端Web开发如何处理横竖屏
<!Doctype html> <html> <head> <meta charset="utf-8"> <meta id=& ...
- ajax请求遇到服务器重启或中断
常会有不断轮询发送ajax请求,处理一些业务的场景. 要考虑到: 1. 服务器重启,中断,恢复后仍然能恢复正常业务处理. 服务器重启过程中,再次发送请求,请求状态将变为net::ERR_CONNECT ...
- QueryRunner的使用
在相继学习了JDBC和数据库操作之后,我们明显感到编写JDBC代码并非一件轻松的事儿.为了帮助我们更高效的学习工作,从JDBC的繁重代码中解脱出来,老佟给我们详尽介绍了一个简化JDBC操作的组件——D ...
- register 不允许 block 模式,而默认的是
Exception in thread "main" java.nio.channels.IllegalBlockingModeException at java.nio.chan ...
- PAT (Basic Level) 1001害死人不偿命的(3n+1)猜想 (15)
卡拉兹(Callatz)猜想: 对任何一个自然数n,如果它是偶数,那么把它砍掉一半:如果它是奇数,那么把(3n+1)砍掉一半.这样一直反复砍下去,最后一定在某一步得到n=1.卡拉兹在1950年的世界数 ...
- bzoj 1053: [HAOI2007]反素数ant 搜索
1053: [HAOI2007]反素数ant Time Limit: 10 Sec Memory Limit: 162 MBSubmit: 1497 Solved: 821[Submit][Sta ...
- 在DJANGO的类视图中实现登陆要求和权限保护
以前接触的是基于函数的保护,网上材料比较多. 但基于类视图的很少. 补上! Decorating class-based views 装饰类视图 对于类视图的扩展并不局限于使用mixin.你也可以使用 ...
- 项目经验谈---IM新消息界面刷新异常处理记录
项目中使用到ContentObserver来观察Provider的变化,当对Uri做数据库操作时对应的Provider会发一条Notify消息调用UI上层的ContentChange方法,在这个Con ...
- SparkSQL配置和使用初探
1.环境 OS:Red Hat Enterprise Linux Server release 6.4 (Santiago) Hadoop:Hadoop 2.4.1 Hive:0.11.0 JDK:1 ...