Hi,
I needed a function to find the first position where one of a set of
characters matches in a string. Alike C function 'strpbrk' if you know it.
Example:
PosSetEx('abcde', 'hello', 1);
Returns 2, because the 'e' is in second position. If no occurance, 0 is
returned (like Pos). The last parameter is the position from where to start
searching (assumes >= 1). PosSet(A,B) can be made by calling PosSetEx
(A,B,1);
Micha
---
function PosSetEx(const ASubStrSet, AString: string;
const Offset: integer): integer;
begin
for Result := Offset to Length(AString) do
if Pos(AString[Result], ASubStrSet) > 0 then
exit;
Result := 0;
end;
_______________________________________________
fpc-devel maillist - [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel