[Cuis-dev] Split string

Gerald Klix cuis.01 at klix.ch
Tue Nov 30 05:55:14 PST 2021


I think on last Saturday I tried to find an equivalent of Python's
str.split-method, in vain, so yes such a method
is very useful.

Here comes a bit of nit-picking:

As far as I can see the `subString copy` send is not necessary.
`subString` only contains newly created strings or the result of
sending #, to the string. #, creates a copy in every implementation.

IHMO it would be more efficient to make `subString` a WriteStream
and add `subString contents` to the result.

Lastly I see no problem in answering the unconverted
result, perhaps someone wants to add more strings/elements
to the result.

Lastly #split: should work in SequenceableCollection
as you implemented it, in fact it would even work with
my suggested changes.

Ok, sorry, I should have written code,
that would have been much more concise.

Just my 0.01€,


On 11/30/21 2:26 PM, Nicola Mingotti via Cuis-dev wrote:
> I vote in favor.
> This function is so hidden it is still red in my cookbook, and up to now
> i just used to Regex to perform this trivial task.
> bye
> Nicola
> On 11/30/21 14:06, Mariano Montone via Cuis-dev wrote:
>> Hello,
>> I have a small proposal.
>> Splitting of strings is a very common operation, but there's no
>> implemention in Cuis core. And so I often need to depend on
>> SqueakCompatibility that implements String>>subStrings: , just because
>> of that.
>> I'd like to move that to Cuis core. I would rename it to String>>split:,
>> but that's not a requirement.
>> I attach the source (I'm not the author, though!).
>> This is the info of the SqueakCompatibility method: 'eem 2/3/2015 12:04
>> ° 18 lines of code ° *squeakCompatibility ° 1 implementor ° 20 senders °
>> in package SqueakCompatibility ° in change sets:
>> 4974-CuisCore-AuthorName-2021Nov19-11h59m, Install-SqueakCompatibility'.
>> Cheers,
>> Mariano

More information about the Cuis-dev mailing list