Ok, so I hope you know how to write to file.
And as you noticed that you have sorted collection I suppose that Customer
s are ordered in the way you want.
Then what you can do is:
(whitepages collect: [ :customer |
customer name,
Character cr asString,
customer number ]) joinUsing: Character cr
This way you'll get a string that you just need to write to the file. Also note that if name
or number
are not strings you can use asString
on them.
The canonical way is to do something like:
whitepages do: [ :customer |
stream
nextPutAll: customer name;
cr;
nextPutAll: customer number;
cr ]
Where stream
is a write stream to a file.