On Fri, 23 Dec 2016 10:04:09 +0100, Gabor Boros
<gaborbo...@yahoo.com> wrote:

>2016. 12. 23. 9:14 keltezéssel, Bo Berglund írta:
>> Is there a quick way to split a string of whitespace separated values
>> into the separate members?

>   SL.DelimitedText:='   0.000    0.000    7.000    0.000  29.6628';

Thanks,
I did not know that one could do this and get away with it. Believed
one had to set the delimiter first and since it is varying number of
spaces it would not work.
But it seems like it does work!

I applied your method by removing all the code for handling this and
used only the following:
{code}
   ReadLn(F, sLine);
   slDecode.DelimitedText := sLine;
   ....

{code}

I timed my original code for a file of some 660000+ lines to 9.9s.
Result:
Original code takes 9.9 s to process the file.
Modified code takes 4.4 s

And I checked with the file containing the extra spaces and varying
size of whitespace. It too was processed correctly.

Thanks again!

-- 
Bo Berglund
Developer in Sweden

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to