Janilabo Posted May 22, 2012 Share Posted May 22, 2012 Inserts value (x) to TSA by index. Example included. TSAInsert [scar]procedure TSAInsert(var TSA: array of string; 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; TSA[index] := str; end; var h, i: Integer; TSA: array of string; begin ClearDebug; for i := 0 to 10 do TSAInsert(TSA, Random(10 + 1), 'i = ' + IntToStr(i)); h := High(TSA); for i := 0 to h do WriteLn('TSA[' + IntToStr(i) + ']: ' + TSA); SetLength(TSA, 0); end.[/scar] Quote Link to comment Share on other sites More sharing options...