Bug in StringLists lazarus / 64-FPC development ---------------------------------------------------------------------- apexcol · 2017-08-11 10:28 I have problems with TStringList... 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 procedure TotaliseByNames;var         SL : TStringList;        I1, I3 : integer;        vElement: TDOMElement;        vInputList: TDOMNodeList;begin   // vInputList is out of scope but is another TStringList        SL := TStringList.Create;        SL.Sorted := true;        for I1 := 0 to pred(vInputList.Count) do begin              vElement := vInputList[I1];                SL.Find(vElement['name'], I3);                if I3 = -1 then  // does not exist then                        SL.AddObject(vElement['name'], vElement) // create the first                else begin                      {some other code that modifies vElement with aritmethic operations...}                end;        FAnotherList.Assign(SL);              end;  on the Finding it breaks the program... Also I tried with IndexOf and it shows a number like 8261232 instead of -1, I checked the code inside and it has some things to fix, for example in stringl.inc line 936 instead of Result:=Result+1; it must be inc(Result), and on sorted list, the add or insert method ought to add it on the right place. ---------------------------------------------------------------------- bytebites · 2017-08-11 11:48 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              if SL.Find(vElement['name'], I3) then begin                        {some other code that modifies vElement with aritmethic operations...}                end                else                  SL.AddObject(vElement['name'], vElement) ---------------------------------------------------------------------- rvk · 2017-08-11 12:33 Why open three posts/topics for this? I answered here: http://forum.lazarus.freepascal.org/index.php/topic,37880.msg255895.ht ml