Delphi 2010 新增功能之: IOUtils 单元(6): TPath(结构体) 的方法与属性
2016-07-02 15:14
501 查看
以后路径相关的处理, 用 IOUtils.TPath 就很方便了.
//较常用的方法: TPath.GetTempPath; {获取临时文件夹路径} TPath.GetTempFileName; {获取一个临时文件名} TPath.GetPathRoot(); {提取盘符, 如: c:\} TPath.GetDirectoryName(); {提取路径} TPath.GetFileName(); {提取文件名} TPath.GetExtension(); {提取扩展名} TPath.GetFileNameWithoutExtension(); {提取无扩展名的文件名} TPath.ChangeExtension(); {更换扩展名} TPath.DriveExists(); {检查路径中的驱动器是否存在} TPath.GetFullPath(); {根据相对路径给出全路径} TPath.HasExtension(); {判断是否有扩展名} TPath.IsPathRooted(); {判断是否是绝对路径} TPath.Combine(); {结合路径} TPath.GetRandomFileName; {产生一个随机文件名} TPath.GetGUIDFileName(); {用于产生一个唯一的文件名, 布尔参数决定名称中是否包含 -} TPath.IsValidPathChar(); {判断给定的字符是否能用于路径名} TPath.IsValidFileNameChar(); {判断给定的字符是否能用于文件名} //不常用的方法 TPath.HasValidPathChars(); TPath.HasValidFileNameChars(); TPath.GetExtendedPrefix(); TPath.IsExtendedPrefixed(); TPath.IsUNCRooted(); TPath.IsDriveRooted(); TPath.IsUNCPath(); TPath.MatchesPattern(); TPath.GetInvalidFileNameChars; TPath.GetInvalidPathChars; TPath.GetAttributes(); TPath.SetAttributes(); //属性, 获取在不同平台下的各种路径分隔符, 都是只读的. TPath.AltDirectorySeparatorChar; {Windows 下是 "\"} TPath.AltDirectorySeparatorChar; {Windows 下是 "/"} TPath.ExtensionSeparatorChar; {Windows 下是 "."} TPath.PathSeparator; {Windows 下是 ";"} TPath.VolumeSeparatorChar; {Windows 下是 ":"}
相关文章推荐
- Delphi 6 保存窗体设置
- Delphi Bpl包学习
- Delphi 读取ini文件
- 在Delphi中读写TXT文件
- 问题-Delphi2007跟踪变量时提示“E2171 Variable 'APolygon' inaccessible here due to optimization”
- Delphi FMX Grid列头样式设定
- 同一界面放两个TTIWDBAdvWebGrid的问题(delphi IW TMS)
- Delphi 的字符及字符串string、AnsiString、WideString、String[n]、ShortString
- delphi’线程新技术 并行计算
- 没有装delphi软件则须修改程序的Uses单元,去掉QDialogs qtintf.dll
- DELPHI读写xml文件
- Delphi之多线程实例
- 郁闷的Delphi新闻
- delphi新语法之泛型实现的对象池模板
- Delphi 编码转换 Unicode gbk big5(使用LCMapString设置区域后,再用API转换)
- 提高Delphi的编译速度(bpl和bcp)
- Delphi COM编程技术三类型库(库文件中的工具栏,很全)
- delphi高手突破学习笔记之面向对象类和对象的本质
- Delphi OleVariant 类型的用法
- 在VC6.0下如何调用Delphi5.0开发的进程内COM