Показать сообщение отдельно
  #2  
Старый 26.04.2015, 14:39
weess weess вне форума
Прохожий
 
Регистрация: 04.03.2015
Сообщения: 5
Версия Delphi: borland 2006
Репутация: 10
По умолчанию

Попробовал сделать через Tstringlist, но не понимаю как действовать дальше.
Код:
var st1,st2:TStringList; i,j,sum,sum2:integer;
begin
if od1.execute  then

  st1:=TStringList.Create; st2:=TStringList.Create;
  st1.LoadFromFile(od1.filename);
  sum:=StrToIntDef(st1.Values['summa'],0);
  sum2:=0;
  for i:=0 to st1.Count-1 do begin
    if copy(st1[i],1,5)<>'summa' then begin
     st2.DelimitedText:=st1[i];
     for j:=0 to st2.Count-1 do
      sum2:=sum2+StrToIntDef(st2[j],0);
    end;
  end;
  if sum2<>sum then begin
   st1.Values['summa']:=IntToStr(sum2);
   st1.SaveToFile(od1.filename);
  end;
  st1.Free; st2.Free;
end;
Ответить с цитированием