Wasn't sure, I'm on Squeak right now!! loll ----------------- Benoît St-Jean Yahoo! Messenger: bstjean Twitter: @BenLeChialeux Pinterest: benoitstjean Instagram: Chef_Benito IRC: lamneth Blogue: endormitoire.wordpress.com "A standpoint is an intellectual horizon of radius zero". (A. Einstein) On Sunday, December 2, 2018, 6:26:12 a.m. EST, Sven Van Caekenberghe <sven@stfx.eu> wrote:
On 2 Dec 2018, at 12:14, Benoit St-Jean via Pharo-users <pharo-users@lists.pharo.org> wrote:
From: Benoit St-Jean <bstjean@yahoo.com> Subject: Re: [Pharo-users] How to take care that the + before a number is ignored Date: 2 December 2018 at 12:14:10 GMT+1 To: pharo-users@lists.pharo.org Reply-To: Benoit St-Jean <bstjean@yahoo.com>
You can do solve the problem without the "lines" variable but, believe me, you want to keep those lines in a collection. It's gonna be a lot easier down the road!
Hint (to solve the problem) : look at what "lines" contain (instances of which class). That class has everything you need to parse those '+2' and '-8' ... ;)
| file |
lines := OrderedCollection new.
file := StandardFileStream readOnlyFileNamed: 'day.1.input'.
That is a deprecated class in Pharo 7.
[file atEnd] whileFalse: [lines add: file nextLine]. file close.
Here is a better way: Array streamContents: [ :lines | Â 'file.log' asFileReference readStreamDo: [ :in | Â Â [ in atEnd ] whileFalse: [ lines nextPut: in nextLine ] ] ]
----------------- Benoît St-Jean Yahoo! Messenger: bstjean Twitter: @BenLeChialeux Pinterest: benoitstjean Instagram: Chef_Benito IRC: lamneth Blogue: endormitoire.wordpress.com "A standpoint is an intellectual horizon of radius zero". (A. Einstein)
On Sunday, December 2, 2018, 6:09:42 a.m. EST, Roelof Wobben <r.wobben@home.nl> wrote:
Op 2-12-2018 om 11:55 schreef Benoit St-Jean via Pharo-users:
Nope, only the part how I can read the file.
Roelof