| Delphi Tips & Tricks | softsale > Delphi Tips & Tricks |
| następna rada > | < poprzednia rada |
Jak określić ostatnią pozycję wystąpienia podstringu w stringu ?
Realizuje to funkcja LastPos.
function stringodwrotnie(s:string):string;
var I:integer;
var spom:string;
begin
spom:='';
for i:=1 to length(s) do spom:=s[i]+spom;
result:=spom;
end;
function LastPos(const SubStr: String; const S: String): Integer;
begin
result := Pos(stringodwrotnie(SubStr), stringodwrotnie(S)) ;
if (result <> 0) then
result := ((Length(S) - Length(SubStr)) + 1) - result + 1;
end;
|
|
SOFTSALE - Oprogramowanie i Szkolenia softsale@softsale.com.pl 03-565 Warszawa , ul. Borzymowska 43 lok. 301C tel/fax:4084840,0607612428 |