Janilabo

Janilabo | TSACopyEx() [SCAR Divi & Simba]

Jul 14th, 2012
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.69 KB | None | 0 0
  1. function CopyTSAEx(TSA: array of string; startIndex, count: Integer): array of string;
  2. var
  3.   i, l, t: Integer;
  4. begin
  5.   l := Length(TSA);
  6.   if (startIndex < 0) then
  7.     startIndex := 0;
  8.   if ((l >= startIndex) and (count > 0)) then
  9.   begin
  10.     t := (l - startIndex);
  11.     if (count > t) then
  12.       count := t;
  13.     SetLength(Result, count);
  14.     for i := startIndex to ((startIndex + count) - 1) do
  15.       Result[(i - startIndex)] := TSA[i];
  16.   end;
  17. end;
  18.  
  19. var
  20.   TSA: array of string;
  21.   i: Integer;
  22.  
  23. begin
  24.   ClearDebug;
  25.   TSA := CopyTSAEx(['TEST1', 'TEST2', 'TEST3', 'TEST4', 'TEST5', 'TEST6', 'TEST7'], 2, 3);
  26.   for i := 0 to High(TSA) do
  27.     WriteLn(TSA[i]);
  28.   SetLength(TSA, 0);
  29. end.
Advertisement
Add Comment
Please, Sign In to add comment