How to pass multiple lines of text to a variable in the easiest way? lazarus / 9-Editor ---------------------------------------------------------------------- loaded · 2021-09-21 13:57 Hi All, Here's how I'm assigning multiple lines of text to a variable of type String. 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 var  kml:String=''+             ''+             ''; Similarly, I use {} to comment multiple lines. Sample ;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 {    } Now my aim is; I want to be able to transfer a text containing multiple lines to a String variable, even if it contains single quotation marks ', without making any corrections or additions, such as the text inside the {} marks above, is this possible? Or is there an easier way? If you can help it would be greatly appreciated. Respects. ---------------------------------------------------------------------- Jurassic Pork · 2021-09-21 14:39 hello, you can try to use the macroEditor with the multlineStr Macro (see here) you paste your multiline text in your code and  launch the macro ( click on the attachment to see animation). Friendly, J.P ---------------------------------------------------------------------- loaded · 2021-09-21 15:19 Jurassic Pork, thank you very much for your hard work. If I can't find one step easier, I'll use this one. ---------------------------------------------------------------------- Kays · 2021-09-21 15:57 Quote from: loaded on September 21, 2021, 03:57:43 pm[…] I want to be able to transfer a text containing multiple lines to a String variable, even if it contains single quotation marks ', without making any corrections or additions, […]I myself tend to forget these tools, but the FPC is shipped with data2inc(1) and bin2obj. Code: Bash  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i bin2obj -a -c head head.xmlThis will require support for and make a typed “constant” which actually is a variable. ---------------------------------------------------------------------- loaded · 2021-09-21 17:54 Thank you very much for your answer, brother Kays, but I am not smart enough to understand what you wrote. I would appreciate it if you could be a little more descriptive. ---------------------------------------------------------------------- Kays · 2021-09-22 16:00 Quote from: loaded on September 21, 2021, 07:54:16 pmThank you very much for your answer, brother Kays, but I am not smart enough to understand what you wrote. I would appreciate it if you could be a little more descriptive.Well, I suppose your XML preamble comes from an external source. If you don’t want to read a file containing the XML preamble during run-time, you can write yourself a script automatically creating a Pascal source code unit file with the aide of data2inc. ---------------------------------------------------------------------- loaded · 2021-09-22 19:11 Yes, you are right, there is a fragment xml in the example I gave. But while I was preparing the post, the kml file came up and I put a piece of it, otherwise don't think I'm using just XML, there may be many different types of text. Regarding the matter, I was looking for an easier way because I didn't want to deal with the memo object in the simplest way. ---------------------------------------------------------------------- PascalDragon · 2021-09-23 07:09 Quote from: loaded on September 21, 2021, 03:57:43 pmNow my aim is; I want to be able to transfer a text containing multiple lines to a String variable, even if it contains single quotation marks ', without making any corrections or additions, such as the text inside the {} marks above, is this possible? Or is there an easier way? If you can help it would be greatly appreciated. Respects. My suggestion is to store the text as an external file and use resources to include them in your binary: test.xml: Code: XML  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i     data.rc: Code: [Select]testxml RCDATA test.xml tres.pp: 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 tres; {$mode objfpc}{$H+} uses  Classes, resource; {$R data.rc} var  kml: String;  ss: TStringStream;  r: TResourceStream;begin  ss := TStringStream.Create;  try    r := TResourceStream.Create(HINSTANCE, 'testxml', PChar(RT_RCDATA));    try      ss.CopyFrom(r, r.Size);    finally      r.Free;    end;     kml := ss.DataString;  finally    ss.Free;  end;   Writeln(kml);end. ---------------------------------------------------------------------- loaded · 2021-09-23 15:15 First of all, thank you very much PascalDragon for the answer. God bless you, I am learning a lot of new things thanks to you. I have a lot of text blocks to use and there will be expressions in these blocks that I need to change or renew, so it doesn't seem like a very practical method for this job, but I have a different situation in mind, and this method is perfect for that situation.