pos不可以么? 如果一定倒着来:比如 189212397234978932123789 先定位后面的123 nowstr:=onestr; snowstr:=sonestr; for i:=0 to length(nowstr)-1 do begin nowstr[i]:=onestr[length(onestr)-1-i] end; for i:=0 to length(soneset)-1 do begin snowstr[i]:=onestr[length(sonestr)-1-i] end; i:= pos(snowstr,nowstr)
strPath := 'C:\abc\ded\123.txt'; strFile := ExtractFileName(strPath); iPos := Pos('.',strFile); Delete(strFile,iPos,Length(strFile)-iPos+1);Now: strFile Is THE STRING YOU WANT!
如果一定倒着来:比如 189212397234978932123789 先定位后面的123
nowstr:=onestr;
snowstr:=sonestr;
for i:=0 to length(nowstr)-1 do
begin
nowstr[i]:=onestr[length(onestr)-1-i]
end;
for i:=0 to length(soneset)-1 do
begin
snowstr[i]:=onestr[length(sonestr)-1-i]
end;
i:= pos(snowstr,nowstr)
strFile := ExtractFileName(strPath);
iPos := Pos('.',strFile);
Delete(strFile,iPos,Length(strFile)-iPos+1);Now: strFile Is THE STRING YOU WANT!