<div dir="ltr">Hi,<div><br></div><div>Were the method new, I wouldn't mind if it treated empty fields differently. But since it is not new, I think this is indeed a change that may break applications if they have relied on the previous behavior. Therefore I vote against it unless it is shown that Squeak is the only Smalltalk that implements subStrings: in the current way. The ANSI standard is unfortunately vague and not much guidance:</div><div><br></div><div>    Synopsis</div>       Answer an array containing the substrings in the receiver separated by the elements of<br>       separators.<br>    Definition: <readableString><br>       Answer an array of strings. Each element represents a group of characters separated by any of the<br>       characters in the list of separators.<div>    Return Values<br>       <Array> unspecified<div><br></div><div>@Chris: does splitBy:, as recommended by Christoph, cover your requirements?<br></div><div><br></div><div>Should we add a message to split on _any_ of the elements of the argument (like subStrings:, unlike splitBy:), preserving empty groups (like splitBy:, unlike subStrings:)? For example, #splitByAnyOf:</div><div><br></div><div>Kind regards,</div><div>Jakob</div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Am Sa., 19. Nov. 2022 um 13:23 Uhr schrieb Thiede, Christoph <<a href="mailto:Christoph.Thiede@student.hpi.uni-potsdam.de">Christoph.Thiede@student.hpi.uni-potsdam.de</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">



<div>

<div id="m_486925936293397501divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p>Hm ... don't we have #<span>splitBy: for this? This seems like a possibly dangerous breaking change to me. No strong opinion, though. :-)</span></p>
<p><span><br>
</span></p>
<p><span>Best,</span></p>
<p><span>Christoph</span></p>
</div>
<hr style="display:inline-block;width:98%">
<div id="m_486925936293397501divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>Von:</b> Squeak-dev <<a href="mailto:squeak-dev-bounces@lists.squeakfoundation.org" target="_blank">squeak-dev-bounces@lists.squeakfoundation.org</a>> im Auftrag von Chris Muller <<a href="mailto:asqueaker@gmail.com" target="_blank">asqueaker@gmail.com</a>><br>
<b>Gesendet:</b> Samstag, 19. November 2022 06:24:43<br>
<b>An:</b> <a href="mailto:squeak-dev@lists.squeakfoundation.org" target="_blank">squeak-dev@lists.squeakfoundation.org</a><br>
<b>Betreff:</b> Re: [squeak-dev] The Inbox: Collections-cmm.1022.mcz</font>
<div> </div>
</div>
<div>
<div dir="ltr">I don't know why subStrings: should behave differently for empty fields as non-empty.
<div><br>
</div>
<div>Before this change, empty fields are ignored:</div>
<div><br>
</div>
<div>    'a:b::d' subStrings: ':'  ==> " #('a' 'b' 'd') "</div>
<div>    '::::' subStrings: ':' ==> #()</div>
<div><br>
</div>
<div>after this change, empty fields are honored:</div>
<div><br>
</div>
<div>    'a:b::d' subStrings: ':'  ==> " #('a' 'b' '' 'd') "</div>
<div>    '::::' subStrings: ':' ==>  #('' '' '' '')</div>
<div><br>
</div>
<div>Thoughts?</div>
<div><br>
</div>
<div> - Chris    <br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Fri, Nov 18, 2022 at 11:14 PM <<a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Chris Muller uploaded a new version of Collections to project The Inbox:<br>
<a href="http://source.squeak.org/inbox/Collections-cmm.1022.mcz" rel="noreferrer" target="_blank">http://source.squeak.org/inbox/Collections-cmm.1022.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Collections-cmm.1022<br>
Author: cmm<br>
Time: 18 November 2022, 11:14:01.223447 pm<br>
UUID: 9a05d251-4f02-43de-94e8-0f077ec51680<br>
Ancestors: Collections-nice.1021<br>
<br>
Allow empty fields when using #subStrings:.<br>
<br>
=============== Diff against Collections-nice.1021 ===============<br>
<br>
Item was changed:<br>
  ----- Method: String>>subStrings: (in category 'converting') -----<br>
  subStrings: separators <br>
        "Answer an array containing the substrings in the receiver separated <br>
        by the elements of separators."<br>
        | char result sourceStream subString |<br>
-       #Collectn.<br>
-       "Changed 2000/04/08 For ANSI <readableString> protocol."<br>
        (separators isString or:[separators allSatisfy: [:element | element isCharacter]]) ifFalse:<br>
                [^ self error: 'separators must be Characters.'].<br>
        sourceStream := ReadStream on: self.<br>
        result := OrderedCollection new.<br>
        subString := String new.<br>
        [sourceStream atEnd]<br>
                whileFalse: <br>
                        [char := sourceStream next.<br>
                        (separators includes: char)<br>
+                               ifTrue: [result add: subString copy.<br>
+                                                       subString := String new]<br>
-                               ifTrue: [subString notEmpty<br>
-                                               ifTrue: <br>
-                                                       [result add: subString copy.<br>
-                                                       subString := String new]]<br>
                                ifFalse: [subString := subString , (String with: char)]].<br>
        subString notEmpty ifTrue: [result add: subString copy].<br>
        ^ result asArray!<br>
<br>
<br>
</blockquote>
</div>
</div>
</div>

<br>
</blockquote></div>