Double CR-LF in text files lazarus / 64-FPC development ---------------------------------------------------------------------- Ednay · 2024-04-05 00:54 I am new to this forum. Originally I used Borland Pascal when programming (in Windows XP) which no longer works in Windows 10. I am still getting used to Free Pascal. This is a sample file: This is a file that has double CR-LF after every line How can the second CR-LF be removed from the original file? ---------------------------------------------------------------------- TRon · 2024-04-05 01:25 Quote from: Ednay on April 05, 2024, 02:54:45 amHow can the second CR- LF be removed from the original file?[/i] Something like this perhaps ? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program fix; uses  classes; var  sl: TStringList;  index: integer;begin  sl := TStringList.Create;  sl.LoadFromFile('Show File.txt');   index := 0;  while index < sl.Count do  begin    if sl[index] = ''     then sl.Delete(index)      else inc(index);  end;   sl.SaveToFile('fixed.txt');  sl.Free;end. ---------------------------------------------------------------------- Bart · 2024-04-05 13:49 Alternatively: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program fix; uses  classes, SysUtils; var  sl: TStringList;  S: String;begin  sl := TStringList.Create;  sl.LoadFromFile('Show File.txt');  S := sl.Text;  S := StringReplace(S,LineEnding+LineEnding,LineEnding,[rfReplaceAll]);   sl.Text := S; //<<== did forget to add this line, as AlexTP pointed out.  sl.SaveToFile('fixed.txt');  sl.Free;end. Bart ---------------------------------------------------------------------- AlexTP · 2024-04-06 13:45 @Bart, you missed the putting S to the list back:   sl.Text := S; ---------------------------------------------------------------------- Bart · 2024-04-06 20:48 Quote from: AlexTP on April 06, 2024, 03:45:49 pm@Bart, you missed the putting S to the list back:   sl.Text := S; Well, spotted: fixed it by editing my post and adding a comment. Bart ---------------------------------------------------------------------- dseligo · 2024-04-06 21:46 Quote from: Bart on April 06, 2024, 10:48:19 pmQuote from: AlexTP on April 06, 2024, 03:45:49 pm@Bart, you missed the putting S to the list back:   sl.Text := S; Well, spotted: fixed it by editing my post and adding a comment. Bart Edit again Change s.Text := S; to: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i sl.Text := S; ---------------------------------------------------------------------- Bart · 2024-04-07 20:27 Quote from: dseligo on April 06, 2024, 11:46:27 pmEdit again Change s.Text := S; to: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i sl.Text := S;   Bart