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的更多相关文章
随机推荐
- CI源码引用使用--php引用demo,静态变量和引用关系
CI源码引用使用在Common.php中,加载配置和类的方法 function &test() { static $a = ''; if (!$a) { $a ...
- Linux进程和进程边界
1. 进程和线程 2. 手机操作系统的发展 3. 进程的地址空间边界 4. 进程边界的安全围栏: Crash的不可扩延性 5. 进程边界的安全围栏: 全局数据和服务的不可访问性 http://www. ...
- django中文件(头像)上传
一些常用的小功能,记录下来 先说一种上传功能. 模板表单 <form enctype="multipart/form-data" name="form1" ...
- const变量与define定义常量的区别
一.概念性区别 const 变量就是在普通变量前边加上一个关键字const,它赋值的唯一机会就是“定义时”,此变量不能被程序修改,存储在rodata区. define定义的是常量,不是变量,所以编译器 ...
- Axure RP的版本控制
首先介绍一下Axure RP,Axure的发音是Ask-Sure,RP是Rapid Prototype的缩写,写到这里你知道了这是一款原型绘画工具.本节主要介绍Axure RP的版本管理也即Axure ...
- 常见HTTP状态码大全
我们经常会遇到404.500.302等提示,它们究竟是什么意思呢?除了这几个常见的状态码外,还有哪些我们没有遇到过的但有可能出现的状态码呢?网站的http状态对于网站维护人员来说是相当重要的,当网站出 ...
- hadoop的一些重要配置参数
hadoop集群管理内存设置 Mapreduce内存使用设置 hadoop job重要性能参数
- hadoop 常用配置项
core-site.xml name value Description fs.default.name hdfs://hadoopmaster:9000 定义HadoopMaster的URI ...
- [BZOJ 1029] [JSOI2007] 建筑抢修 【贪心】
题目链接:BZOJ - 1029 题目分析 使用一种贪心策略. 现将任务按照deadline从小到大排序. 然后枚举每一个任务,如果当前消耗的时间加上完成这个任务的时间不会超过这个任务的deadlin ...
- char类型关联
SQL> create table a1(id int,name char(10)); Table created. SQL> create table a2(id int,name ch ...