my QuickSort algotihm doesn't work lazarus / 21-General ---------------------------------------------------------------------- danmal0827 · 2021-02-14 00:16 Hello , I'm trying to sort a tstringlist which i load from  the file .It's about 5000 lines of numbers (line by line ) I got an Error which tells me   "Incompatible type for arg no. 2: Got "LongInt", expected "AnsiString"" I have sorted it already with Insertion and Selection Sort , but this one makes me really hopless.                   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 QucikSort(Items: TStrings; L, R : integer);var i, j , p , Temp : integer ;  begin    Repeat      i := L ;      J := R ;      P:= ( i+ J) shr 1 ;      repeat        while Items[i] < Items[P] // <---Error Message        do Inc(i);        while Items[J] > Items[P]        do Dec(J) ;        if I <=J        then        begin          Temp := Items.Valueof[i];          Items[i]:= Items[J];          Items[J]:= Temp;          if P = J          then P:= J          else if P=J   ;        then P:=J;          Inc(i);          Dec(J);          end;      Until i >J;        if L:=i;        Until i>=R;        end; ---------------------------------------------------------------------- Blaazen · 2021-02-14 01:07 Basically, you must use: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 CompareStr(Items[i], Items[P])>=0But you have to take care of encoding. There are also UTF8CompareStr() and others in various units. ---------------------------------------------------------------------- danmal0827 · 2021-02-14 09:29 thanks for your answer ! i'll ty to write this procedure