(newbie) String / Array / ArrayedCollection

Ramon Leon rleon at insario.com
Fri Dec 30 19:55:58 UTC 2005


> (String streamContents: [:stream |
> 	'A series of words to be shuffled' substrings shuffled
> 		do: [:each | stream nextPutAll: each]
> 		separatedBy: [stream space]])
> 
> - Bert -
> 

That's still a lot of typing for what most other languages call join.
On of the first extentions methods I added to Collection was this..

join: aString 
  ^String streamContents: [:stream |
    self do: [:each | stream nextPutAll: each asString]
         separatedBy: [stream nextPutAll: aString]]



More information about the Squeak-dev mailing list