[fpc-devel]Fix To StrUtils.PosExe

Karl Brandt pascalive at bol.com.br
Mon May 17 01:50:41 CEST 2004


I noticed that the cited function is not working properly, so i made
some (small) changes to fix it.

Here is the fixed version:

Function PosEx(const SubStr, S: string; Offset: Cardinal): Integer;
var i : pchar;
begin
   if (offset<1) or (offset>length(s)) then exit(0);
   i:=strpos(@s[offset], at substr[1]); //Changed here
   if i=nil then
     PosEx:=0
   else
     PosEx:=Succ(i-pchar(s)); // And here
end;

In my program it is working properly, but more tests are wellcome/necessary

Luiz Américo







More information about the fpc-devel mailing list