怎样分离文件名(50分)

  • 主题发起人 主题发起人 sdwflzg
  • 开始时间 开始时间
S

sdwflzg

Unregistered / Unconfirmed
GUEST, unregistred user!
用OpenDialog取出文件名后,文件名中含有“路径+文件名+扩展文件名”,怎样用简单的方法将“文件名”“扩展文件名”分离出来?
 
最笨就是查找最后一个/号然后用copy
 
Returns the extension portions of a file name.

Unit

SysUtils

Category

file name utilities

function ExtractFileExt(const FileName: string): string;

Description

Use ExtractFileExt to obtain the extension from a file name. For example, the following code returns the extension of the file name specified by a variable named MyFileName:

MyFilesExtension := ExtractFileExt(MyFileName);

The resulting string includes the period character that separates the name and extension parts. This string is empty if the given file name has no extension.

Note: This function works for multi-byte character systems (MBCS).
 
ExtractFileExt
ExtractFileName
ExtractFilePath
 
同意楼上,就是这几个函数了。
 
接受答案了.
 
后退
顶部