Показать сообщение отдельно
  #3  
Старый 26.08.2010, 21:45
Аватар для Vayrus
Vayrus Vayrus вне форума
Исполняемый Ретровирус
 
Регистрация: 09.08.2008
Адрес: Umbrella Corporation
Сообщения: 743
Репутация: 1293
Лампочка

Всем спасибо, помог код друга (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;
Ответить с цитированием