起步软件技术论坛-X3

 找回密码
 立即注册
搜索
查看: 210|回复: 1

[请求]急!怎么取文件名?**

[复制链接]
发表于 2007-5-30 11:13:17 | 显示全部楼层 |阅读模式
比如,我有个Opendialog控件,用FileName属性得到是全路径名,我只想要文件名,怎么实现?
回复

使用道具 举报

发表于 2007-5-30 11:27:13 | 显示全部楼层
NameSpace: Business.System    ClassDelcare: Business.System.FileSys
----------------------------------------------------------------------------
TFileUtils = class(TObject)
public
  constructor create;
  function AddExtName(AFileName: string; Extension: string): string;
  function AddPathSeparator(APath: string): string;
  function ChangeFileExt(AFileName: string; Extension: string): string;
  function ExcludeFilePrefix(AFileName: string; Prefix: string): string;
  function ExcludeFileServer(AFileName: string; Server: string): string;
  procedure ExpandFileList(AFileName: string; AFiles: TStrings);
  function ExpandFileName(ABasePath: string; ARelativeFileName: string): string;
  function ExtractRelativePath(ABasePath: string; AAbsFileName: string): string;
  function FileByOSFile(AOSFileName: string): string;
  procedure ForceDirectories(Dir: string);
  function GetDirectory(AFileName: string): string;
  function GetDriveName(AFileName: string): string;
  function GetFileExt(AFileName: string): string;
  function GetFileName(AFileName: string): string;
  function GetFileNameNoExt(AFileName: string): string;
  function GetFilePrefix(AFileName: string): string;
  function GetFileServer(AFileName: string): string;
  function GetFullFileID(AFileName: string): string;
  function GetPath(AFileName: string): string;
  function GetServerName(AFileName: string): string;
  function IsServer(AFileName: string): Boolean;
  function MakeFileName(ADirectory: string; AOnlyFileName: string): string;
  function OSFileByFile(AFileName: string): string;
  function PathIsUNC(Path: string): Boolean;
  function RemoveExtName(AFileName: string): string;
  function RemoveFilePrefix(AFileName: string): string;
  function RemovePathSeparator(APath: string): string;
  function ReplaceServer(AFileName: string; ANewServer: string): string;
  function ReplaceServerName(AFileName: string; ANewServerName: string): string;
  function SameServer(FileName1: string; FileName2: string): Boolean;
  function SplitFileExt(AFileName: string): string;
  function SplitFileName(AFileName: string; LeavePath: Boolean): string;
  function ValidPathSeparator(APath: string): Boolean;
  property PathDelim: Char; readonly;
  property ServerDelim: string; readonly;
  property SpaceDelim: Char; readonly;
end;
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Justep Inc.

GMT+8, 2025-1-11 00:37 , Processed in 0.038882 second(s), 15 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表