home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / STSRCHP.ZIP / STTEST.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1988-12-01  |  709 b   |  35 lines

  1. { A small program to test the StSearch unit.  See StSearch.Pas for }
  2. { more information on the StrSearch function. }
  3.  
  4. program StTest;
  5.  
  6. uses StSearch;
  7.  
  8.  
  9. var
  10.   Vec              : StrSearchTable;
  11.   Index            : Word;
  12.   St1,St2          : String;
  13.  
  14. begin
  15.   repeat
  16.     Write('   Enter string: ');
  17.     ReadLn(St1);
  18.     Write('Enter substring: ');
  19.     ReadLn(St2);
  20.     if (St1 <> '') and (St2 <> '') then begin
  21.  
  22.       Vec := StrSearch(St1,St2);
  23.  
  24.       Write('The positions are:  ');
  25.       Index := 1;
  26.       while (Vec^[Index] > Terminator) do begin
  27.         Write(Vec^[Index],'  ');
  28.         Inc(Index);
  29.       end;
  30.       WriteLn;
  31.     end
  32.   until (St1 = '') or (St2 = '');
  33. end.
  34.  
  35.