<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<meta content="text/html; charset=UTF-8">
<style type="text/css" style="">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p>As always, I will be glad about any feedback :)</p>
<div id="x_Signature">
<div name="x_divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div><font size="2" color="#808080"></font></div>
</div>
</div>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>Von:</b> Squeak-dev <squeak-dev-bounces@lists.squeakfoundation.org> im Auftrag von commits@source.squeak.org <commits@source.squeak.org><br>
<b>Gesendet:</b> Donnerstag, 15. August 2019 23:33:53<br>
<b>An:</b> squeak-dev@lists.squeakfoundation.org<br>
<b>Betreff:</b> [squeak-dev] The Inbox: Collections-ct.850.mcz</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">A new version of Collections was added to project The Inbox:<br>
<a href="http://source.squeak.org/inbox/Collections-ct.850.mcz">http://source.squeak.org/inbox/Collections-ct.850.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Collections-ct.850<br>
Author: ct<br>
Time: 15 August 2019, 11:33:51.432735 pm<br>
UUID: f0af391e-59c7-4b41-815c-0aa3ae8afb6d<br>
Ancestors: Collections-fn.847<br>
<br>
Implement formatting on Text<br>
<br>
Try out something like:<br>
'Hello {1}!' asText format: {Utilities authorInitials asText allBold}.<br>
<br>
=============== Diff against Collections-fn.847 ===============<br>
<br>
Item was added:<br>
+ ----- Method: Text class>>new:streamContents: (in category 'instance creation') -----<br>
+ new: newSize streamContents: blockWithArg<br>
+ <br>
+        | stream |<br>
+        stream := TextStream on: (self new: newSize).<br>
+        blockWithArg value: stream.<br>
+        ^ stream contents!<br>
<br>
Item was added:<br>
+ ----- Method: Text>>format: (in category 'formatting') -----<br>
+ format: arguments <br>
+        "format the receiver with arguments, respecting the format both of receiver and collection elements"<br>
+        <br>
+        ^self class new: self size * 11 // 10 streamContents: [ :output |<br>
+                | nextIndex |<br>
+                nextIndex := 1.<br>
+                [ nextIndex <= self size ] whileTrue: [<br>
+                        (self at: nextIndex) caseOf: {<br>
+                                [$\] -> [<br>
+                                        nextIndex := nextIndex + 1.<br>
+                                        output withAttributes: (runs at: nextIndex) do: [<br>
+                                                output nextPut: (self at: nextIndex) ] ].<br>
+                                [${] -> [<br>
+                                        "Parse the index - a positive integer in base 10."<br>
+                                        | character collectionIndex attributes |<br>
+                                        collectionIndex := 0.<br>
+                                        attributes := Set new.<br>
+                                        [ (character := string at: (nextIndex := nextIndex + 1)) isDigit ] whileTrue: [<br>
+                                                collectionIndex := collectionIndex * 10 + character digitValue.<br>
+                                                attributes addAll: (runs at: nextIndex) ].<br>
+                                        character = $} ifFalse: [ self error: '$} expected' ].<br>
+                                        output withAttributes: attributes do: [<br>
+                                                output nextPutAll: (arguments at: collectionIndex) asStringOrText ] ] }<br>
+                                otherwise: [<br>
+                                        output withAttributes: (runs at: nextIndex) do: [<br>
+                                                output nextPut: (self at: nextIndex) ] ].<br>
+                        nextIndex := nextIndex + 1 ] ]!<br>
<br>
<br>
</div>
</span></font>
</body>
</html>