Good evening all.
I have a StringList and each record contains a multi-line string.
MyStringList [0]:
<li>
Test1
</li>
MyStringList [1]:
<a href="#">
<b>
Test2
</b>
</a>
etc.
How can I save and load those strings to a file (text, ini, binary, record, savetofile, etc.) ? The main issue is than I can save it to a text file, but when reading back, each line is considered a new record while there are 3 lines for the first record, 5 lines for the second and so on.
What do you suggest for a process to save and load those strings ?
If you save it to a
.txt
file, you lose the ability to re-load it correctly, since you don't know if a give line break was originally embedded in a string, or separates two strings.If you save it to another textual format, like
.ini
, you can escape/unescape the line breaks as needed, eg:end;
If you save it to a binary format, you can preserve the line breaks as-is, eg: