我的思路是一直用POS函数,查到一个删除一个/,当没有查到/时,那上一次的pos位置就是最后出现的位置,给你写了个函数,
function PosEnd(const substr,str : string) : integer;
var
tmp : string;
i,j,flag : integer;
begin
flag := -1;
tmp := str;
i := pos(substr,tmp);
while i <> 0 do
begin
delete(tmp,i,1);
inc(flag);
j := i;
i := pos(substr,tmp);
end;
result := j + flag;
end;
调用方法
caption:= 12/456/78/900
i := PosEnd('/',caption) //10