[Delphi (Object Pascal)] Delphi 返回子字符串在字符串最后一次出现的位置 →→→→→进入此内容的聊天室

来自 , 2021-03-31, 写在 Delphi (Object Pascal), 查看 133 次.
URL http://www.code666.cn/view/94aada62
  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

回复 "Delphi 返回子字符串在字符串最后一次出现的位置"

这儿你可以回复上面这条便签

captcha