[fpc-pascal] How to split file of whitespace separated numbers?
Sven Barth
pascaldragon at googlemail.com
Fri Dec 23 14:06:50 CET 2016
Am 23.12.2016 12:54 schrieb "Graeme Geldenhuys" <
mailinglists at geldenhuys.co.uk>:
>
> On 2016-12-23 08:14, Bo Berglund wrote:
> > Is there a quick way to split a string of whitespace separated values
> > into the separate members?
>
>
> That problem is perfectly suited for regular expressions. And a rather
> simple one at than. The FPC's FCL packages include a regex unit too
> which should suite your needs.
>
>
> http://www.regex101.com/
>
> http://www.regexplained.co.uk/
>
> http://regex.info/
> Even the trial book (first chapter only) of "Mastering Regular
> Expressions" is invaluable for users new to regex. And will
> explain all you need to know to solve your problem.
>
Regular expressions usually have a higher overhead however (as you might
have noticed, Bo timed his code later on).
For example at work I changed a regular expression based parser for the
lines of a log file to a simpler one and the speedup was noticeable (I
don't have exact numbers anymore however).
Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20161223/c775308b/attachment.html>
More information about the fpc-pascal
mailing list