M meet Unregistered / Unconfirmed GUEST, unregistred user! 2002-11-19 #1 字符取值的问题如:(F:/aa/bb/cc.avi),现在我要取出bb/cc.avi怎么取?<br>当然F:/aa/bb/cc.avi这只是一个例子还可能是F:/aaaa/bbbb/cc.avi,结果<br>是文件名和它的上一级目录一起取出
字符取值的问题如:(F:/aa/bb/cc.avi),现在我要取出bb/cc.avi怎么取?<br>当然F:/aa/bb/cc.avi这只是一个例子还可能是F:/aaaa/bbbb/cc.avi,结果<br>是文件名和它的上一级目录一起取出
X XWHope Unregistered / Unconfirmed GUEST, unregistred user! 2004-01-16 #6 str:='F:/aaaa/bbbb/cc.avi';<br> while pos('/',str)>0 do<br> begin<br> tmp:=str;<br> delete(str,1,pos('/',str));<br> end;<br> showmessage(tmp);<br><br>tmp就是你想要的
str:='F:/aaaa/bbbb/cc.avi';<br> while pos('/',str)>0 do<br> begin<br> tmp:=str;<br> delete(str,1,pos('/',str));<br> end;<br> showmessage(tmp);<br><br>tmp就是你想要的
M meet Unregistered / Unconfirmed GUEST, unregistred user! 2004-01-16 #8 to lysandria:<br>Copy函数可以你写点代码试试,,,,
F fanronghua Unregistered / Unconfirmed GUEST, unregistred user! 2004-01-16 #9 str := 'c:/aaa/bbb/ccc.com';<br> R := StrScan(pchar(str), '/');<br> {R = '/aaa/bbb/ccc.com'}<br>自己想办法!
str := 'c:/aaa/bbb/ccc.com';<br> R := StrScan(pchar(str), '/');<br> {R = '/aaa/bbb/ccc.com'}<br>自己想办法!
来 来如风 Unregistered / Unconfirmed GUEST, unregistred user! 2004-01-16 #10 i := lastdelimiter('/',copy(str,1,lastdelimiter('/',str)-1));//i 是integer型<br> copy(str,i+1,length(str)-i); //i是倒数第二个'/'的位置,
i := lastdelimiter('/',copy(str,1,lastdelimiter('/',str)-1));//i 是integer型<br> copy(str,i+1,length(str)-i); //i是倒数第二个'/'的位置,
Z ZRWeng Unregistered / Unconfirmed GUEST, unregistred user! 2004-01-16 #11 2002-2004年了,还没解决吗?<br><br>var<br> str:string;<br> L:TStringList;<br>begin<br> str:='c:/abc/cc/dd.avi';<br> L:=TStringList.Create;<br> L.Delimiter:='/';<br> L.DelimitedText:=str;<br><br> showMessage(L.Strings[l.Count-2]+<br> L.Delimiter+<br> L.Strings[l.count-1]);<br> L.Free;<br>end;
2002-2004年了,还没解决吗?<br><br>var<br> str:string;<br> L:TStringList;<br>begin<br> str:='c:/abc/cc/dd.avi';<br> L:=TStringList.Create;<br> L.Delimiter:='/';<br> L.DelimitedText:=str;<br><br> showMessage(L.Strings[l.Count-2]+<br> L.Delimiter+<br> L.Strings[l.count-1]);<br> L.Free;<br>end;
S sunrain_114 Unregistered / Unconfirmed GUEST, unregistred user! 2004-01-16 #12 function Tform1.GetIt(Str:String):String;<br>var<br> tempStr:String;<br> ReStr:String;<br> ipos:Integer;<br>begin //F:/aaaa/bbbb/cc.avi<br> ipos := pos('/',Str);<br> tempStr := Str;<br> while ipos<>0 do<br> begin<br> tempStr := copy(tempStr,ipos+1,length(tempStr)-ipos);<br> ipos := pos('/',tempStr);<br> if ipos<>0 then<br> ReStr := tempStr;<br> end;<br> Result := ReStr;<br>end;<br><br>这样就ok了, :)
function Tform1.GetIt(Str:String):String;<br>var<br> tempStr:String;<br> ReStr:String;<br> ipos:Integer;<br>begin //F:/aaaa/bbbb/cc.avi<br> ipos := pos('/',Str);<br> tempStr := Str;<br> while ipos<>0 do<br> begin<br> tempStr := copy(tempStr,ipos+1,length(tempStr)-ipos);<br> ipos := pos('/',tempStr);<br> if ipos<>0 then<br> ReStr := tempStr;<br> end;<br> Result := ReStr;<br>end;<br><br>这样就ok了, :)
W weadvance Unregistered / Unconfirmed GUEST, unregistred user! 2004-01-16 #14 function Tform1.GetIt(Str:String):String;<br>var<br> tempStr:String;<br> ReStr:String;<br> ipos:Integer;<br>begin //F:/aaaa/bbbb/cc.avi<br> ipos := pos('/',Str);<br> tempStr := Str;<br> while ipos<>0 do<br> begin<br> tempStr := copy(tempStr,ipos+1,length(tempStr)-ipos);<br> ipos := pos('/',tempStr);<br> if ipos<>0 then<br> ReStr := tempStr;<br> end;<br> Result := ReStr;<br>end;<br><br>这样就ok了, :) <br>
function Tform1.GetIt(Str:String):String;<br>var<br> tempStr:String;<br> ReStr:String;<br> ipos:Integer;<br>begin //F:/aaaa/bbbb/cc.avi<br> ipos := pos('/',Str);<br> tempStr := Str;<br> while ipos<>0 do<br> begin<br> tempStr := copy(tempStr,ipos+1,length(tempStr)-ipos);<br> ipos := pos('/',tempStr);<br> if ipos<>0 then<br> ReStr := tempStr;<br> end;<br> Result := ReStr;<br>end;<br><br>这样就ok了, :) <br>
M meet Unregistered / Unconfirmed GUEST, unregistred user! 2004-01-16 #15 to XWHope<br>你的方法行,,,分为给你了,,,