expandfilename(filename)
用这个函数便可
用这个函数便可
解决方案 »
- odac不安装客户端连接oracle问题
- 儿歌一首
- 点击DBGRID后,如何得到选中行某一列的值呢???
- 怎么定义共用的函数?
- 谁提供或知道哪有双机高速通迅的源代码(并串口的不要),加100分。
- dbgrid中文本的获得?
- form2是form1中show出来的,form1关闭时,form2不关闭,form1重新showmodal出来,form2就不能操作了,怎办?
- 鼠标移动终涉及的算法问题
- 哪有李维的delphi 5.x ado/mts/com+ 的pdf的书下? 急用
- 如何在DELPHI程序中调Windos的拨号程序?
- 怎样将最大最小化按钮去掉
- 请问英语高手,在哪个网站,有关于下载自学英语软件
var temp : string; temp := ExtractFileName(FileName);
result := Copy(temp,0,LastDelimiter('.',temp) - 1);
var
s:string;
t:string;
begin
s:='abc.dbf';
t:=copy(s,1,pos('.',s)-1);
showmessage(t);
end;
test:string;
test1:integer;
begin
if opendialog1.Execute then
edit1.Text := ExtractFileName(opendialog1.FileName);
test := copy(edit1.Text,1,pos( '.',edit1.Text) - 1);
edit2.Text :=test;
end;现在,edit1.text是文件名,edit2.text就是你想要的。
要是我这个变态取个什么t.t.t.jpeg的文件,岂不是不行了?
为了避免楼上的情况('t.t.t.jpg')就将从字符串的最后开始查找如下
Function SepreateStr(filename:string):string;
var
strTmp:sstring;
i:integer;
begin
for i:=length(filename)-1 downto 0 do
strTmp:=copy(filename,i,i+1);
if strTmp='.' then
begin
result:=copy(filename,0,i-1);
break;
end;
end;