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

2016-12-23 Thread Graeme Geldenhuys
On 2016-12-23 18:27, Marco van de Voort wrote: > Writing or even worse, reading/debugging regex is about the most intensive > effort there is IMHO. So is standard programming code - if you don't know the syntax or how it works. ;-) Also the reason why I posted a couple of links to regex sites to

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

2016-12-23 Thread Graeme Geldenhuys
On 2016-12-23 18:04, Sven Barth wrote: > E.g. > opening a log file in 10 seconds vs nearly none make a difference Again, it depends on the tool (editor) you use. Both jEdit and EditPad Pro (implement in Delphi) uses regex for syntax highlighting. EditPad Pro also uses it for file navigation, synt

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

2016-12-23 Thread Marco van de Voort
In our previous episode, Graeme Geldenhuys said: > For many other things, plain code could be faster, but often a lot more > effort and time consuming to implement. Where as you could have written > a regex expression in under 10 seconds and accomplish the same task 8 > lines of code or less - very

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

2016-12-23 Thread Sven Barth
On 23.12.2016 18:46, Graeme Geldenhuys wrote: > On 2016-12-23 13:06, Sven Barth wrote: >> Regular expressions usually have a higher overhead > > That is not always a given. You are aware that I wrote "usually" there? > For many other things, plain code could be faster, but often a lot more > ef

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

2016-12-23 Thread Graeme Geldenhuys
On 2016-12-23 13:06, Sven Barth wrote: > Regular expressions usually have a higher overhead That is not always a given. I remember years back we had a similar discussion, but then about syntax highlighting large code units. eg: The the large OSX related unit in FPC (can't remember how many MB's

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

2016-12-23 Thread greim
Hey Kids, why so complicated? Good old Niklaus Wirth has already everything done for you: I have to cite one sentence on the last slide at his birthday colloquium: "Reducing size and complexity is the triumph" So READ is already quite clever, it doesn't care about whitespaces, carriage return

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

2016-12-23 Thread Sven Barth
Am 23.12.2016 12:54 schrieb "Graeme Geldenhuys" < mailingli...@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

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

2016-12-23 Thread Graeme Geldenhuys
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 suit

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

2016-12-23 Thread Howard Page-Clark
On 23/12/16 08:14, Bo Berglund wrote: Is there a quick way to split a string of whitespace separated values into the separate members? It is possible that a custom string parser (something along these lines) might improve your processing speed: type TDoubleArray = array of Double; functio

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

2016-12-23 Thread Bo Berglund
On Fri, 23 Dec 2016 10:04:09 +0100, Gabor Boros 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.0000.0007.0000.000 29.6628'; Thanks, I did no

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

2016-12-23 Thread Gabor Boros
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? Hi, I don't know quick or not... program Project1; uses Classes; var SL:TStringList; i:Integer; begin SL:=TStringList.Create; SL.Delimi

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

2016-12-23 Thread Bo Berglund
Is there a quick way to split a string of whitespace separated values into the separate members? I have to create a function to process a number of big data files where numbers are stored in lines of 4-6 values using whitespace inbetween. First I got a sample looking like this: {code} 0.41670.3