减少文件路径名的长度
点击次数:40 次 发布日期:2008-11-09 08:40:36 作者:源代码网
|
源代码网推荐 c:windowsmedia empabcsoundchime.wav 源代码网推荐 我希望它能缩短成: 源代码网推荐 c:windows..soundchime.wav 源代码网推荐 如何写程序呢? 源代码网推荐 源代码网推荐 function shortenfilename(s : string) : string; 源代码网推荐 var 源代码网推荐 drive,curdrive : string[2]; 源代码网推荐 dir,curdir : string[80]; 源代码网推荐 name : string[20]; 源代码网推荐 ext : string[5]; 源代码网推荐 i : byte; 源代码网推荐 begin 源代码网推荐 for i:=1 to length(s) do s[i]:=upcase(s[i]); 源代码网推荐 s:=fexpand(s); 源代码网推荐 fsplit(s,dir,name,ext); 源代码网推荐 drive:=copy(dir,1,2); 源代码网推荐 dir:=copy(dir,4,length(dir)-3); 源代码网推荐 getdir(0,curdir); 源代码网推荐 curdrive:=copy(curdir,1,2); 源代码网推荐 curdir:=copy(curdir,4,length(curdir)-3) ‘"; 源代码网推荐 if drive=curdrive then begin 源代码网推荐 if copy(dir,1,length(curdir))=curdir then begin 源代码网推荐 i:=length(curdir); 源代码网推荐 if length(dir)<>i then dir:=dir ‘"; 源代码网推荐 shortenfilename:=copy(dir,i 1,length(dir)-i-1) name ext; 源代码网推荐 end else shortenfilename:=copy(s,3,length(s)-2); 源代码网推荐 end else shortenfilename:=s; 源代码网推荐 end; 源代码网推荐 源代码网供稿. |
