INDEX.I

[Table of Contents]

The INDEX.I include file resides on the Kyan Pascal 2.x Disk #2. It includes one function.


  • function INDEX


Source Code

function index(var a1,a2:string):
   integer;

var i,j,k,l:integer;

begin

i:=maxstring;
while ((a2[i] = ' ') and (i <> 1))
   do i:=i-1;
k:=0;
repeat
j:=1;
l:=1;
   while(j<=i) do begin
      if(a1[j+k] <> a2[j]) then l:=0;
      j:=j+1;
   end;
   k:=k+1;
until((l=1) or ((i+k)>maxstring));
if(l=1) then index:=k
   else index:=0;
end;





No comments:

Post a Comment