Registriert seit: 23. Sep 2002
Ort: Frankfurt am Main (in der Nähe)
1.840 Beiträge
Delphi 10 Seattle Enterprise
|
Re: Pos info ???
16. Dez 2004, 15:27
Zitat von sakura:
@SubData: Falsch, gibt es in Delphi 5 noch nicht Aber in der CodeLib findest Du diesen Beitrag.
Cool ASM.
Der Orginal Quelltext von Borland sieht so aus:
Delphi-Quellcode:
{ *********************************************************************** }
{ Delphi Runtime Library }
{ Copyright (c) 1995-2001 Borland Software Corporation }
{ *********************************************************************** }
...
{ PosEx searches for SubStr in S and returns the index position of
SubStr if found and 0 otherwise. If Offset is not given then the result is
the same as calling Pos. If Offset is specified and > 1 then the search
starts at position Offset within S. If Offset is larger than Length(S)
then PosEx returns 0. By default, Offset equals 1. }
...
function PosEx(const SubStr, S: string; Offset: Cardinal = 1): Integer;
var
I,X: Integer;
Len, LenSubStr: Integer;
begin
if Offset = 1 then
Result := Pos(SubStr, S)
else
begin
I := Offset;
LenSubStr := Length(SubStr);
Len := Length(S) - LenSubStr + 1;
while I <= Len do
begin
if S[I] = SubStr[1] then
begin
X := 1;
while (X < LenSubStr) and (S[I + X] = SubStr[X + 1]) do
Inc(X);
if (X = LenSubStr) then
begin
Result := I;
exit;
end;
end;
Inc(I);
end;
Result := 0;
end;
end;
...
(°¿°) MaBuSE - proud to be a DP member
(°¿°) MaBuSE - proud to be a "Rüsselmops" ;-)
|
|
Zitat
|