TStringList functionality for Integer types lazarus / 21-General ---------------------------------------------------------------------- sporex · 2021-03-04 14:17 After exploring the usefulness of TStringList, especially for LOG files of limited size I am wondering whether a similar class exists for Integer types or even for Records? In particular I am looking for a similar function like this one of TStringList for integers or even records: TStringList.Delete(0); TStringList.Add('XY'); which makes it very easy to implement a ring buffer. Thx for advice ---------------------------------------------------------------------- Handoko · 2021-03-04 15:00 TStringList is for string, for non-string items you can try TList or TFPList. Or maybe you should check it: https://wiki.freepascal.org/Data_Structures,_Containers,_Collections ---------------------------------------------------------------------- wp · 2021-03-04 15:21 In unit "integerlist", package LazUtils, there is a TIntegerList. It specializes TFPGList and thus has all the methods of it: Example: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses  IntegerList; procedure TForm1.Button1Click(Sender: TObject);var  L: TIntegerList;begin  L := TIntegerList.Create;  try    L.Add(1);    L.Add(10*L[0]);    ShowMessage(IntToStr(L.Count));    L.Delete(0);    ShowMessage(IntToStr(L[0]));  finally     L.Free;  end;end; ---------------------------------------------------------------------- ASBzone · 2021-03-04 15:23 Beyond TList, consider whether or not a Dynamic Array would be helpful for you: https://wiki.freepascal.org/FPC_New_Features_3.2.0#Dynamic_Arrays_supp orted_by_Insert.28.29 ---------------------------------------------------------------------- Handoko · 2021-03-04 15:39 That's great, I didn't know about it. That feature is very useful. Thank you for informing and thank you for adding the feature. ---------------------------------------------------------------------- sporex · 2021-03-04 15:47 This unit "integerlist", package LazUtils seems to be great. Provides apparently all functionalities of TStringList. Thx a lot ---------------------------------------------------------------------- wp · 2021-03-04 17:06 Quote from: Handoko on March 04, 2021, 04:39:08 pmthank you for adding the feature. This goes to Juha. ---------------------------------------------------------------------- Bart · 2021-03-04 19:58 Quote from: sporex on March 04, 2021, 03:17:55 pmwhich makes it very easy to implement a ring buffer. There is TDeque in gdeque unit, which implements a generic double ended queue. Bart