Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {==============================================================================]
- Explanation: Inserts str to index position in TSA.
- [==============================================================================}
- procedure TSAInsert(var TSA: TStrArray; index: Integer; str: string);
- var
- i, l: Integer;
- begin
- l := Length(TSA);
- SetLength(TSA, (l + 1));
- if (index < 0) then
- index := 0;
- if (index > l) then
- index := l;
- if (l > index) then
- for i := (l - 1) downto index do
- TSA[(i + 1)] := TSA[i];
- TSA[index] := string(str);
- end;
- var
- tmp: TStrArray;
- h, i: Integer;
- begin
- ClearDebug;
- tmp := ['Test1', 'Test2', 'Test4', 'Test5'];
- TSAInsert(tmp, 2, 'Test3');
- h := High(tmp);
- for i := 0 to h do
- WriteLn(tmp[i]);
- end.
Advertisement
Add Comment
Please, Sign In to add comment