Janilabo

Janilabo | MSSL_TSAStuff()

Apr 19th, 2013
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.10 KB | None | 0 0
  1. function MSSL_TSAStuff(TSA, strs: TStrArray; iFrom, iCount: Integer): TStrArray;
  2. {==============================================================================]  
  3.   Created: April 19th, 2013.
  4.   Contributors: Janilabo
  5.   Explanation: Returns TSA stuffed with strs.
  6.                iFrom=start position, iCount=count of chars to stuff with.                  
  7. [==============================================================================}
  8. var
  9.   h, i, l: Integer;
  10. begin
  11.   l := Length(TSA);
  12.   SetLength(Result, l);
  13.   for i := 0 to (l - 1) do
  14.     Result[i] := Copy(TSA[i], 1, Length(TSA[i]));
  15.   MSSL_IntSetRange(iFrom, 0, (l - 1));
  16.   if (iCount > 0) then
  17.     Delete(Result, iFrom, iCount);            
  18.   h := High(strs);
  19.   if (h > -1) then
  20.   begin        
  21.     l := Length(Result);                            
  22.     SetLength(Result, (l + (h + 1)));
  23.     MSSL_IntSetRange(iFrom, 0, l);      
  24.     for i := (l + h) downto (iFrom + (h + 1)) do
  25.       Swap(Result[i], Result[(i - (h + 1))]);  
  26.     for i := 0 to h do
  27.       Result[(i + iFrom)] := Copy(strs[i], 1, Length(strs[i]));      
  28.   end;          
  29. end;
Advertisement
Add Comment
Please, Sign In to add comment