[fpc-pascal] How to split file of whitespace separated numbers?

Luiz Americo Pereira Camara luizamericop at gmail.com
Sat Dec 31 15:30:26 CET 2016


2016-12-31 8:18 GMT-03:00 Bo Berglund <bo.berglund at gmail.com>:

> On Sat, 31 Dec 2016 11:27:53 +0100, greim
>
> The Readln approach followed by splitting in a stringlist is enough of
> an improvement that I can use it.
>
>
Did you look at StrUtils.ExtractSubStr ?

Should be faster than TStrings;

PosWord := 1;
Word := ExtractSubstr(Line, PosWord, [' ']);
while (Word <> '') do
begin
  //do work
  Word := ExtractSubstr(Line, PosWord, [' ']);
end;

Luiz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20161231/3d63998e/attachment.html>


More information about the fpc-pascal mailing list