join
Todd Blanchard
tblanchard at mac.com
Fri Sep 15 03:36:38 UTC 2006
Poking around a frequently used image I find:
String>>splitOn: aString
and
SequenceableCollection>>joinOn: aString
And I use them quite a bit when processing input.
On Sep 14, 2006, at 6:31 PM, Avi Bryant wrote:
> On Sep 14, 2006, at 6:25 PM, Klaus D. Witzel wrote:
>
>> Hi Keith,
>>
>> on Fri, 15 Sep 2006 01:57:52 +0200, wrote:
>> ...
>>> any thoughts? I am curious as to why #join: hasn't made it into
>>> the core image, and if it were to how would it happen?
>>
>> There are several reasons for the absence of #join:
>>
>> - the most important one is, that nobody needs it (or else you
>> would have found it). Imagine Pearl with the full Squeak Stream
>> hierarchy, why use join?
>
> Sure we need it. At Smallthought, we have a package of utility
> methods that includes:
>
> SequencableCollection>>joinTokens: aString
> ^ String streamContents:
> [:s |
> self do: [:ea | s nextPutAll: ea asString] separatedBy: [s
> nextPutAll: aString]]
>
> Looking through my sends to it, the argument is always either ' '
> or ', ', so #joinedWithSpaces and #joinedWithCommas would probably
> be sensible methods to have too.
>
> Avi
>
More information about the Squeak-dev
mailing list
|