[fpc-devel] Is the code in wiki correct?

Michael Van Canneyt michael at freepascal.org
Mon May 11 09:25:52 CEST 2020



On Sun, 10 May 2020, Amir wrote:

> I assume StringJoin and StringSplit are one of the basic operations on Array 
> of Strings and Strings. It looks like there is no easy way to use TStringList 
> (that is claimed by the wiki to be a fancy "dynamic array or set of 
> Strings"). These are not CSV-kind of functionalities...

DelimitedText does what you need for join: it joins strings together with a
separator. The limitation is that the separator must be a single char.
We inherited this limitation from Delphi.

The example you pointed at, did more than join: it did a stringreplace,
to work around this limitation, and the stringreplace was wrong.

>  Are these functionalities implemented in rtl?

Join exists, it is "DelimitedText"; with abovementioned limitation.

Split exists as a type helper for string:
https://www.freepascal.org/docs-html/current/rtl/sysutils/tstringhelper.split.html


Michael.


More information about the fpc-devel mailing list