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笔记
1 CI不区分大小写2. http://xxx.com/index/[控制器名称]/[控制器里面方法的确名称]/[传入方法的参数 ]/ 3. 控制器及控制器类名称与文件名称一致, 继承 CI_Cont ...
- oracle sqlldr控制文件模板
Sqlldr userid=lgone/tiger control=a.ctl LOAD DATA INFILE 't.dat' // 要导入的文件 // INFILE 'tt.date' // 导入 ...
- 最近采用Instruments
最近采用Instruments 来分析整个应用程序的性能.发现很多有意思的点,以及性能优化和一些分析性能消耗的技巧,小结如下. Instruments使用技巧 关于Instruments官方有一个很有 ...
- ajax 异步上传视频带进度条并提取缩略图
最近在做一个集富媒体功能于一身的项目.需要上传视频.这里我希望做成异步上传,并且有进度条,响应有状态码,视频连接,缩略图. 服务端响应 { "thumbnail": "/ ...
- C#快递单号查询源码
源码本人测试过,没有啥问题,能查询快递单号,支持的快递还挺多,圆通快递.申通快递.韵达快递的都支持单号查询的,程序是通过向爱快递(www.aikuaidi.cn)接口传输参数来查询快递单号,我直接把代 ...
- lamp环境中的/到底是指的网站根目录还是linux的根
在lamp中经常会用到 require,require_once等包含文件的语句. 如果你使用相对路径没有问题. 但是如果你使用了这样的语句就要小心了. 对于如图网站目录 require_once ' ...
- python生成随机二进制文件
import random def genFile(filename,block=1,size=1): f=open(filename,"wb") content="&q ...
- EOF
Process to end of file 就是处理到文件的结束 以经典的 A + B Problem 为例 把每一行的两个数字加起来,然后打印出来,直到文件末尾 c 语言表示:
- [译]36 Days of Web Testing(五)
Day 23 禁用CSS Disable CSS 为什么 ? CSS,层叠样式表,是用来定义web页面布局和显示的机制.通过修改CSS样式,可以改变整个页面的外观. 但是有一些人,因为之前的选择或者 ...
- sleep与wait的区别,详细解答(通过代码验证)
package com.ysq.test; /** * sleep与wait的区别: * @author ysq * */ public class SleepAndWait { public sta ...