Имя пользователя:
Пароль:  
Помощь | Регистрация | Забыли пароль?  

Показать сообщение отдельно

Новый участник


Сообщения: 5
Благодарности: 1

Профиль | Отправить PM | Цитировать


Вот еще что нашел:
Код: Выделить весь код
///////////////////////////////////////////////////////////////////////////////
// Find given text in given file, and replace
// complete textline with given text.
// Created: March 27, 2002 by S.T.I.Bracke
// Revised: May 22, 2002 by S.T.I.Bracke
function ReplaceLine(strFilename, strFind, strNewLine: String): Boolean;
var
  strTemp : String;
  iLineCounter : Integer;
  a_strTextfile : TArrayOfString;
 
begin
  { Load textfile into string array }
  LoadStringsFromFile(strFilename, a_strTextfile);
 
  { Search trough all textlines for given text }
  // old line
  // for iLineCounter := 1 to High(a_strTextfile) do
  // new line corrected by Nikolaus Moll
  for iLineCounter := 0 to GetArrayLength(a_strTextfile)-1 do
    begin
      { Overwrite textline when text searched for is part of it }
      if (Pos(strFind, a_strTextfile[iLineCounter]) > 0) then
        a_strTextfile[iLineCounter] := strNewLine;
    end;
 
  { Save string array to textfile (overwrite, no append!) }
  SaveStringsToFile(strFilename, a_strTextfile, False);
 
  Result := True;
 
end;
Результат тот же.

Отправлено: 19:47, 25-06-2010 | #1992