Всем спасибо, помог код друга (Thanks PESI;-)):
Код:
function SortLengthItem(SL: TStringList; Index1, Index2: Integer): Integer;
begin
Result := 0;
if Length( SL[Index1] ) > Length( SL[Index2] ) then
Result := -1
else
if Length( SL[Index1] ) < Length( SL[Index2] ) then
Result := 1;
end;
function Sort2(const InFile: String): boolean;
Var
SL: TStringList;
begin
RESULT := FALSE;
if not fileexists() then Exit;
SL:= TStringList.Create;
try
sl.LoadFromFile(InFile);
SL.CustomSort(@SortLengthItem);
SL.SaveToFile(InFile);
finally
SL.Free;
end;
RESULT := TRUE;
end;