Delphi returns the position of the substring at the last occurrence of the string

From , 5 Years ago, written in Delphi (Object Pascal), viewed 201 times.
URL https://pastebin.vip/view/96a4d89b
  1. function LastPos(const SubStr, Str: string): Integer;
  2. var
  3.   Idx: Integer; // an index of SubStr in Str
  4. begin
  5.   Result := 0;
  6.   Idx := StrUtils.PosEx(SubStr, Str);
  7.   if Idx = 0 then
  8.     Exit;
  9.   while Idx > 0 do
  10.   begin
  11.     Result := Idx;
  12.     Idx := StrUtils.PosEx(SubStr, Str, Idx + 1);
  13.   end;
  14. end;
  15. //delphi/2322

Reply to "Delphi returns the position of the substring at the last occurrence of the string"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website