[fpc-pascal] TStringList Bug?

Jeremy Cowgar jeremy at cowgar.com
Tue Sep 26 17:42:00 CEST 2006


I was hoping to use it to parse a pipe delimited file. This will not  
work as I do not want " chars as part of the result, I'd have to add  
it in, then subtract them out. That's kind of weird behavior that a  
delimiter would be forced (space) even when the delimiter field is set.

Thanks for the info though, I'll figure another way.

Jeremy

On Sep 26, 2006, at 11:27 AM, Michael Van Canneyt wrote:

>
>
> 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
>>
> _______________________________________________
> 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