[fpc-pascal] TStringList Bug?

Michael Van Canneyt michael at freepascal.org
Tue Sep 26 17:27:15 CEST 2006



On Tue, 26 Sep 2006, Jeremy Cowgar wrote:

> Below is a simple program that I *think* is working wrong. I am new to Pascal,
> so I may very well be doing something wrong.
> 
> Can anyone comment?

Space is always a delimiter.

You should use

SL.DelimitedText := '"Hello World"|"How are you doing?"';

Michael.
> 
> Jeremy
> 
> --------------------
> 
> program stringlistbug;
> 
> uses Classes;
> 
> var
> 	SL : TStringList;
> begin
> 	SL := TStringList.Create;
> 	SL.Delimiter := '|';
> 	SL.DelimitedText := 'Hello World|How are you doing?';
> 	
> 	writeln('One ="', SL[0], '"');
> 	writeln('Two ="', SL[1], '"');
> end.
> 
> (*
> Output:
>    $ ./stringlistbug
>    One ="Hello"
>    Two ="World"
> 
> Shouldn't it be:
>    $ ./stringlistbug
>    One = "Hello World"
>    Two = "How are you doing?"
> *)
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> 



More information about the fpc-pascal mailing list