[squeak-dev] The Inbox: Collections-cmm.1022.mcz

Tobias Pape Das.Linux at gmx.de
Sat Nov 19 20:05:06 UTC 2022


So does that throw away ANSI compat?
-t

> On 19. Nov 2022, at 13:23, Thiede, Christoph <Christoph.Thiede at student.hpi.uni-potsdam.de> wrote:
> 
> Allow empty fields when using #subStrings:.
> 
> =============== Diff against Collections-nice.1021 ===============
> 
> Item was changed:
>   ----- Method: String>>subStrings: (in category 'converting') -----
>   subStrings: separators 
>         "Answer an array containing the substrings in the receiver separated 
>         by the elements of separators."
>         | char result sourceStream subString |
> -       #Collectn.
> -       "Changed 2000/04/08 For ANSI <readableString> protocol."
>         (separators isString or:[separators allSatisfy: [:element | element isCharacter]]) ifFalse:
>                 [^ self error: 'separators must be Characters.'].
>         sourceStream := ReadStream on: self.
>         result := OrderedCollection new.
>         subString := String new.
>         [sourceStream atEnd]
>                 whileFalse: 
>                         [char := sourceStream next.
>                         (separators includes: char)
> +                               ifTrue: [result add: subString copy.
> +                                                       subString := String new]
> -                               ifTrue: [subString notEmpty
> -                                               ifTrue: 
> -                                                       [result add: subString copy.
> -                                                       subString := String new]]
>                                 ifFalse: [subString := subString , (String with: char)]].
>         subString notEmpty ifTrue: [result add: subString copy].
>         ^ result asArray!




More information about the Squeak-dev mailing list