Greetings,
I have this code:
******
read
"read the category file into the dictionary
the first item is the category, the rest of the line are payees
office expense|home depot|staples|costco
groceries|natures best|jewel|trader joes|fresh thyme
"
| f line |
f := FileStream oldFileNamed: myfile.
[(line := f nextLine) notNil] whileTrue: [ | array cat payees |
array := line findTokens: $| escapedBy: Character
tab .
cat := array first.
payees := array reject: [ :i | i = cat
]. "rest of the line"
payees do: [ :p | mydict at: (p
withBlanksCondensed) put: (cat withBlanksCondensed)].
].
f close.
*********
I am getting some blank lines in the data file. Lines with just a Character
cr. I was wondering how to handle that. In other languages, there is a break
for the loop, to go to the end. I can do:
(line size < 2) ifTrue: [ f nextLine.].
But that would interfere with the notNil idiom at the end of the file. So
where do I put this. Is there a common way to jump to the end?
Sincerely,
Joe.
_______________________________________________
Beginners mailing list
[email protected]
http://lists.squeakfoundation.org/mailman/listinfo/beginners