<div dir="ltr">This works:<div><br></div><div>| s out |<br>s := 'eg11dc5cad154625885bc70d4f42818e' readStream.<br>out := (String new: 20) writeStream.</div><div>#( 8 4 4 4 ) do: [:count | out nextPutAll: (s next: count); nextPut: $-].<br>out nextPutAll: (s upToEnd); contents<br></div><div><br></div><div>It has the advantage of not depending on #joinSeparatedBy:, so it works in versions of Smalltalk that don't include it (like Cuis).</div><div><br></div><div>- Jon</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 9 Mar 2023 at 14:55, Tim Johnson <<a href="mailto:digit@sonic.net">digit@sonic.net</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">Hi all,<br>
<br>
I was toying with different ways to add hyphens to a string in a <br>
specific pattern, like for a UUID.  Here's what I came up with:<br>
<br>
| s oc |<br>
s := 'eg11dc5cad154625885bc70d4f42818e' readStream.<br>
oc := OrderedCollection new.<br>
#( 8 4 4 4 12 ) do: [:count | oc add: (s next: count)].<br>
oc joinSeparatedBy: $-<br>
<br>
"  'eg11dc5c-ad15-4625-885b-c70d4f42818e'  "<br>
<br>
<br>
Does anyone have any more graceful or clever ways of accomplishing this?<br>
<br>
Thanks,<br>
Tim<br>
<br>
<br>
<br>
</blockquote></div>