[Cuis-dev] Split string

Todd Blanchard tblanchard at mac.com
Tue Nov 30 18:48:48 PST 2021


Pharo has a method splitOn: aStringIt 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')
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20211201/3c5f532c/attachment.htm>


More information about the Cuis-dev mailing list