(newbie) String / Array / ArrayedCollection
Bert Freudenberg
bert at impara.de
Fri Dec 30 12:23:07 UTC 2005
Am 29.12.2005 um 22:24 schrieb David T. Lewis:
> Quite right. For example:
>
> (String streamContents: [:stream |
> 'A series of words to be shuffled' substrings shuffled
> do: [:e | stream nextPutAll: e; nextPut: Character space]])
> allButLast
>
> or:
>
> String streamContents: [:stream |
> 'A series of words to be shuffled' substrings shuffled
> inject: ''
> into: [:sep :e | stream nextPutAll: sep; nextPutAll: e.
> ' ']]
#do:separatedBy: is meant exactly for that. Also, Stream understands
#space itself:
(String streamContents: [:stream |
'A series of words to be shuffled' substrings shuffled
do: [:each | stream nextPutAll: each]
separatedBy: [stream space]])
- Bert -
More information about the Squeak-dev
mailing list
|