Welcome, Guest
Username: Password: Remember me
General Purpose Components and Libraries, discussions, problems and suggestions
  • Page:
  • 1

TOPIC:

Problem with function "AnsiReplaceText" 11 years 11 months ago #4355

  • sam
  • sam's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 20
  • Thank you received: 2
Hello,

the method "AnsiReplaceText" does not work. ( with Typhon 4.4 r42002 FPC 2.7.1 i386-win32-win32/win64)

Run the following example code an then compare the text-files.

EDIT: FProjectName:string; is in private-section of TForm
procedure TForm1.Button1Click(Sender: TObject);
var
  _tempList:TStringList;
begin
  FProjectName:='project1';
  _tempList:=TStringList.create;
  try
    _tempList.add('\gen\com\pascal\lcltest');
    _tempList.savetofile('before_ansireplacetext.txt');
    _tempList.Text := AnsiReplaceText(_tempList.Text, 'com\pascal\lcltest','com\pascal\'+ FProjectName);
    _tempList.savetofile('after_ansireplacetext.txt');
  finally
    _tempList.free;
  end;
end;

I also tried with Lazarus 1.0.10 r41613 FPC 2.6.2 i386-win32-win32/win64. It' works.

Please Log in or Create an account to join the conversation.

Last edit: by sam.

Problem with function "AnsiReplaceText" 11 years 11 months ago #4356

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4565
  • Thank you received: 1123
Thanks Sir
We will check this
PilotLogic Architect and Core Programmer

Please Log in or Create an account to join the conversation.

Problem with function "AnsiReplaceText" 11 years 10 months ago #4388

  • sam
  • sam's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 20
  • Thank you received: 2
Hi,

I have reported this issue now in the FPC Bugtracker.
Report #24853

The problem seems to be even worse. It's not a problem of "AnsiReplaceText". It look's like something messed up in fpc 2.7.1 with Variable's defined inside the class and later on initialized inside a method.

Please Log in or Create an account to join the conversation.

  • Page:
  • 1