比如:
我有一个路径C:\Documents and Settings\Administrator\My Documents\a.txt
我要得取a.txt的文件名,请问如何取得我试过用rightstr(str,place)取得,但出现错误
我有一个路径C:\Documents and Settings\Administrator\My Documents\a.txt
我要得取a.txt的文件名,请问如何取得我试过用rightstr(str,place)取得,但出现错误
或
LeftStr(SourceString, Length(SourceString) - 4));
a.txt这个文件名的长度是不确定的
可能是abc.txt
a.txt这个文件名的长度是不确定的
可能是abc.txt
----------------------
上面还没解决?你的具体意思是?
1. ExpandFileName
将当前驱动器名(盘符)、路径名和指定的文件名合成一个绝对文件名。
函数原型如下:
function ExpandFileName(const FileName: string): string;
返回值为合成的绝对文件名。
2. ExpandUNCFileName
获取一个以U N C格式的包括网络驱动器名的绝对文件名。
函数原型如下:
function ExpandUNCFileName(const FileName: string): string;
3. ExtractFileDir
从绝对文件名中获取目录名。
函数原型如下:
function ExtractFileDir(const FileName: string): string;
4. ExtractFileDrive
从绝对文件名中获取驱动器号(盘号)。
函数原型如下:
function ExtractFileDrive(const FileName: string): string;
5. ExtractFileExt
从绝对文件名中获取文件名的扩展名。
函数原型如下:
function ExtractFileExt(const FileName: string): string;
6. ExtractFileName
从绝对文件名中获取文件名。
函数原型如下:
function ExtractFileName(const FileName: string): string;
7. ExtractFilePath
从绝对文件名中获取路径名。
函数原型如下:
function ExtractFilePath(const FileName: string): string;
8. ExtractRelativePath
从绝对文件名中获取相对于某一个路径的相对路径名。
函数原型如下:
function ExtractRelativePath(const BaseName, DestName: string): string;
9. ExtractShortPathName
将长文件名转化成短文件名。
函数原型如下:
function ExtractShortPathName(const FileName: string): string;
就像:
a.txt得到a
hell.exe等到hello
rightstr(str,place)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
要使用上面函数,需要uses StrUtils单元
请问ExtractFileName如何使用?
[Error] NoteBook.pas(138): Undeclared identifier: 'rightstr'
rightstr(str,place)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
要使用上面函数,需要uses StrUtils单元如何解决?