unit Unit1;

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的更多相关文章

随机推荐

  1. 疯狂的表单-html5新增表单元素和属性

    疯狂的表单 2015/11/27 16:44:07 从三方面来介绍html5表单的新特性 表单结构更灵活 要提交数据的控件可以布局在form标签之外,看下面的代码,表单元素可以写到form元素之外,只 ...

  2. 如何便携使用github

    Git是一个分布式的版本控制系统,最初由Linus Torvalds编写,用作Linux内核代码的管理.在推出后,Git在其它项目中也取得了很大成功,尤其是在Ruby社区中.目前,包括Rubinius ...

  3. 控制器view加载

    出自李明杰讲课视频

  4. 精通 Oracle+Python,第 3 部分:数据解析

    进行数据解析的理由不计其数,相关的工具和技巧也同样如此.但是,当您需要用这些数据做一些新的事情时,即使有“合适的”工具可能也是不够的.这一担心对于异类数据源的集成同样存在.用来做这项工作的合适工具迟早 ...

  5. Word神器使用

    调整自动换行符的换行起始点: 拖拽下面的三角部分(三角下面的四边形部分不要碰),就可以调整自动编号的换行后的其实点在哪里.

  6. iOS:NAV+TABLE结合

    功能:点击列表项,用列表字符串作为参数创建一个新视图,新视图默认可以有一个BACK按钮回到上一个视图 // // main.m // Hello // // Created by lishujun o ...

  7. Contest20140710 eagleeggs

    eagleeggs|eagleeggs.in|eagleeggs.out 题目描述: 共有N个硬度相同的鹰蛋,硬度是一个整数(并且已知其不大于H),表示这个蛋从天上掉下来不摔碎的最大高度.为了找出这个 ...

  8. JVM参数配置大全

    前阵子遇到几个面试题都是关于对Java内存控制的,因此从网上找到这篇文章,希望自己对Java的内存分配有重新的认识 /usr/local/jdk/bin/java -Dresin.home=/usr/ ...

  9. Scanner 与 Readable 的read()方法

    Readable接口中的read()方法实现了将字符串读入charBuffer中,但是只有在需要输出的时候才会调用. Scanner是文本扫描器类,利用Scanner扫描并输出charBuffer中的 ...

  10. WITH AS 优化逻辑读

    SQL> select * from fxqd_list_20131115_new where (acct_no, oper_no, seqno, trans_amt) not in (sele ...