[fpc-pascal] Split and Join

Luca Olivetti luca at ventoso.org
Fri Nov 27 22:07:28 CET 2009


En/na Michael Van Canneyt ha escrit:

> 
> Of course it does exist. Split can be implemented like this:
> 
> List:=TStringList.Create;
> List.Delimiter:=Delim;
> List.StrictDelimiters:=True;
> List.DelimitedText:=Str;


Never though of it. And join can be done too.
Pity that delimiter is a single character.
e.g., in python I can do

 >>> l=('one','two','three')
 >>> ', '.join(l)
'one, two, three'
 >>> ', '.join(l).split(', ')
['one', 'two', 'three']



it's handy nevertheless.

Bye
-- 
Luca



More information about the fpc-pascal mailing list