[fpc-devel] Is the code in wiki correct?
Amir
amir at aavani.net
Sat May 9 07:16:20 CEST 2020
Hi there,
I was looking for a native implementation for JoinStrings and ended
up in TStringList-TStrings_Tutorial
<https://wiki.freepascal.org/TStringList-TStrings_Tutorial>.
<https://wiki.freepascal.org/TStringList-TStrings_Tutorial>
In Conversion to and from delimited strings
<https://wiki.freepascal.org/TStringList-TStrings_Tutorial#Conversion_to_and_from_delimited_strings>
section, it claims the following code works if the separator is a string:
MyStringList:= TStringList.create;
MyStringList.SkipLastLineBreak := True;
MyStringList.add('1');
MyStringList.add('2');
MyStringList.add('3');
result := StringReplace(MyStringList.Text,Lineending,'\n',
[rfReplaceAll, rfIgnoreCase]);
I believe this is not correct. What if there is a newline(LineEnding) in
one of the strings?
Best,
Amir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20200508/070fc8a5/attachment.htm>
More information about the fpc-devel
mailing list