[Cuis-dev] Split string

Hernan Wilkinson hernan.wilkinson at 10pines.com
Wed Dec 1 12:06:17 PST 2021


I have had the same problems when looking for this message and the problem
is I never remember its name! I know it exists but I do not remember its
name :-)
For some reason I look for split ...
Maybe we can add split to send findTokens: ? just to help finding it
because if it is happening to many of us it means something :-)

Cheers!
Hernan.

On Wed, Dec 1, 2021 at 12:03 AM Todd Blanchard via Cuis-dev <
cuis-dev at lists.cuis.st> wrote:

> Pharo has a method splitOn: aString
>
> It is not precisely the same.  The argument is taken to be a substring to
> be treated as a single delimiter rather than a set of delimiter characters.
>
> So..
>
> 'Hello World' findTokens: 'ol'. -> anOrderedCollection('He' ' W' 'r' 'd')
> 'Hello World' splitOn: 'ol'. -> #('Hello World')
> 'Hello World' splitOn: 'lo'. -> #('Hel' ' World')
>
> Its partner is aSequenceableCollection joinUsing: aString
> #('Hel' ' World') joinUsing: 'p the'. -> 'Help the World'
>
> I myself use them quite a lot and if you were to add them, it would be
> nice if they matched what is found in other Smalltalks, although I confess
> I don't love the names either.
>
> On Nov 30, 2021, at 10:26 AM, Juan Vuletich via Cuis-dev <
> cuis-dev at lists.cuis.st> wrote:
>
> Isn't that essentially the same as #findTokens: ?
>
> 'Hello World' findTokens: 'o'. -> an
> OrderedCollection('Hell' ' W' 'rld').
> 'Hello World' split: 'o'. -> #('Hell' ' W' 'rld').
>
> 'Hello World' findTokens: 'ol'. -> an
> OrderedCollection('He' ' W' 'r' 'd')
> 'Hello World' split: 'ol'. -> #('He' ' W' 'r' 'd')
>
>
>
> --
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev
>


-- 
<https://10pines.com/>Hernán WilkinsonSoftware Developer & Coach

Alem 896, Floor 6, Buenos Aires, Argentina

+54 11 6091 3125

@HernanWilkinson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20211201/dbe4e462/attachment.htm>


More information about the Cuis-dev mailing list