Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {==============================================================================]
- Explanation: Removes items from TSA with index positions (x). DYNAMIC deletion.
- [==============================================================================}
- procedure TSARemove(var TSA: TStrArray; x: TIntArray);
- var
- i, h, h2: Integer;
- begin
- h := High(TSA);
- h2 := High(x);
- if ((h > -1) and (h2 > -1)) then
- for i := 0 to h2 do
- if ((x[i] <= h) and (x[i] > -1)) then
- begin
- Delete(TSA, x[i], 1);
- Dec(h);
- end;
- end;
- var
- tmp: TStrArray;
- h, i: Integer;
- begin
- ClearDebug;
- tmp := ['TEST1', 'Test1', 'Test2', 'TEST2', 'TEST3', 'Test3', 'TEST4', 'Test4'];
- TSARemove(tmp, [6, 4, 3, 0]);
- h := High(tmp);
- for i := 0 to h do
- WriteLn(tmp[i]);
- end.
Advertisement
Add Comment
Please, Sign In to add comment