Janilabo

Janilabo | TIAPosMultiEx() [SCAR Divi]

May 8th, 2013
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.61 KB | None | 0 0
  1. function TIAPosMultiEx(TIA, ints: TIntArray): TIntArray;
  2. var
  3.   i, h, r: Integer;
  4. begin
  5.   h := High(TIA);            
  6.   if ((High(ints) > -1) and (h > -1)) then
  7.   begin
  8.     SetLength(Result, (h + 1));
  9.     for i := 0 to h do
  10.       if TIAContains(ints, TIA[i]) then
  11.       begin
  12.         Result[r] := i;
  13.         Inc(r);
  14.       end;
  15.   end;
  16.   SetLength(Result, r);
  17. end;
  18.  
  19. var
  20.   TIA: TIntArray;
  21.  
  22. begin
  23.   ClearDebug;
  24.   SetLength(TIA, 20);
  25.   FillTIAEx(TIA, [1, 2, 3, 4, 5]);
  26.   WriteLn(TIAToStr(TIA));
  27.   WriteLn('[1, 5] positions in TIA: ' + TIAToStr(TIAPosMulti(TIA, [1, 5])));
  28.   SetLength(TIA, 0);
  29. end.
Advertisement
Add Comment
Please, Sign In to add comment