<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi David W.&nbsp;<div class="">please read inline responses<br class=""><div><blockquote type="cite" class=""><div class="">On 25 Feb 2017, at 07:26, David Waite &lt;<a href="mailto:david@alkaline-solutions.com" class="">david@alkaline-solutions.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Ted,&nbsp;<div class=""><br class=""></div><div class="">It might have helped if instead of being called String and Character, they were named Text and ExtendedGraphemeCluster.&nbsp;</div></div></div></blockquote>Imho,l “text” maybe, but in computer programming “String” is more appropriate, I think. see:</div><div><a href="https://en.wikipedia.org/wiki/String_(computer_science)" class="">https://en.wikipedia.org/wiki/String_(computer_science)</a>&nbsp;</div><div><br class=""></div><div>Also imho, “Character” is OK (but maybe “Symbol” would be better) &nbsp;because mostly, when working</div><div>with text/strings in an application it is not important to know how the Character is encoded,&nbsp;</div><div>e.g. Unicode, ASCII, whatever.(OOP , please hide the details, thank you) &nbsp;</div><div><br class=""></div><div>However, If I needed to work &nbsp;with the character’s components directly, e.g. when I&nbsp;</div><div>might want to influence the display of</div><div>the underlying graphical aspects, I always have access to the Characters’ properties&nbsp;</div><div>and methods. Unicode codepoints, ASCII bytes.. whatever it contains...&nbsp;</div><div>&nbsp; &nbsp;</div><div><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class="">They don’t really have the same behavior or functionality as string/characters in many other languages, especially older languages. This is because in many languages, strings are not just text but also random-accesss (possibly binary) data.</div></div></div></blockquote>could be but that’s not my perception of a string.&nbsp;<br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class=""><br class=""></div><div class="">Thats not to say that there aren’t a ton of algorithms where you can use Text like a String, treat ExtendedGraphemeCluster like a character, and get unicode behavior without thinking about it.</div><div class=""><br class=""></div><div class="">But when it comes to random access and/or byte modification, you are better off working with something closer to a traditional (byte) string interface.</div><div class=""><br class=""></div><div class="">Trying to wedge random access and byte modification into the Swift String will simply complicate everything, slow down the algorithms which don’t need it, eat up more memory, as well as slow down bridging between Swift and Objective C code.</div></div></div></div></blockquote>Yes, this has been extensively discussed in this thread...<br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class=""><br class=""></div><div class="">Hence me suggesting earlier working with Data, [UInt8], or [Character] within the context of your manipulation code, then converting to a Swift String at the end. Convert to the data format you need, then convert back.</div></div></div></div></blockquote>That’s exactly what I did, saved that I have the desire to work exclusively with discrete</div><div>&nbsp;(in the model of humanly visible discrete elements on a graphical medium) ...&nbsp;</div><div><br class=""></div><div>For the sake of completeness ,here is my complete Swift 3.x playground example, may useful for others too:</div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><font size="2" class="">//: Playground - noun: a place with Character!</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 21px;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">import</span><span style="font-variant-ligatures: no-common-ligatures" class=""> UIKit</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">import</span><span style="font-variant-ligatures: no-common-ligatures" class=""> Foundation</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 21px;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(112, 61, 170);" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">struct</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> TGString: </span><span style="font-variant-ligatures: no-common-ligatures" class="">CustomStringConvertible</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">{</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">var</span><span style="font-variant-ligatures: no-common-ligatures" class=""> ar = [</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Character</span><span style="font-variant-ligatures: no-common-ligatures" class="">]()</span></font></div><p style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 21px;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></font></p><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">var</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> description: </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">String</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span><span style="font-variant-ligatures: no-common-ligatures" class="">// used by "print" and "\(...)"</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">return</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">String</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ar</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; }</font></span></div><p style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 21px;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></font></p><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures" class="">// Construct from a String</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">init</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">_</span><span style="font-variant-ligatures: no-common-ligatures" class=""> str : </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">String</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ar</span><span style="font-variant-ligatures: no-common-ligatures" class=""> = </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Array</span><span style="font-variant-ligatures: no-common-ligatures" class="">(str.</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">characters</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; }</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures" class="">// Construct from a Character array</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">init</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">_</span><span style="font-variant-ligatures: no-common-ligatures" class=""> tgs : [</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Character</span><span style="font-variant-ligatures: no-common-ligatures" class="">])</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ar</span><span style="font-variant-ligatures: no-common-ligatures" class=""> = tgs</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; }</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures" class="">// Construct from anything. well sort of..</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">init</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">_</span><span style="font-variant-ligatures: no-common-ligatures" class=""> whatever : </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">Any</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ar</span><span style="font-variant-ligatures: no-common-ligatures" class=""> = </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Array</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b" class="">"</span><span style="font-variant-ligatures: no-common-ligatures" class="">\</span><span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b" class="">(</span><span style="font-variant-ligatures: no-common-ligatures" class="">whatever</span><span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b" class="">)"</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">characters</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; }</font></span></div><p style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 21px;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></font></p><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">var</span><span style="font-variant-ligatures: no-common-ligatures" class=""> $: </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">String</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">get</span><span style="font-variant-ligatures: no-common-ligatures" class=""> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #008400" class="">// return as a normal Swift String</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">return</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">String</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ar</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; }</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">set</span><span style="font-variant-ligatures: no-common-ligatures" class=""> (str) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #008400" class="">//Mutable: set from a Swift String</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ar</span><span style="font-variant-ligatures: no-common-ligatures" class=""> = </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Array</span><span style="font-variant-ligatures: no-common-ligatures" class="">(str.</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">characters</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; }</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; }</font></span></div><p style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 21px;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></font></p><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">var</span><span style="font-variant-ligatures: no-common-ligatures" class=""> asString: </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">String</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">get</span><span style="font-variant-ligatures: no-common-ligatures" class=""> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #008400" class="">// return as a normal Swift String</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">return</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">String</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ar</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; }</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">set</span><span style="font-variant-ligatures: no-common-ligatures" class=""> (str) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #008400" class="">//Mutable: set from a Swift String</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ar</span><span style="font-variant-ligatures: no-common-ligatures" class=""> = </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Array</span><span style="font-variant-ligatures: no-common-ligatures" class="">(str.</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">characters</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; }</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; }</font></span></div><p style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 21px;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></font></p><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures" class="">// Return the count of total number of characters:</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">var</span><span style="font-variant-ligatures: no-common-ligatures" class=""> count: </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Int</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">get</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">return</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ar</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">count</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; }</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; }</font></span></div><p style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 21px;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></font></p><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures" class="">// Return empty status:</span></font></div><p style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 21px;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></font></p><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">var</span><span style="font-variant-ligatures: no-common-ligatures" class=""> isEmpty: </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Bool</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">get</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">return</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ar</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">isEmpty</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; }</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; }</font></span></div><p style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 21px;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></font></p><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures" class="">// s[n1..&lt;n2]</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">subscript</span><span style="font-variant-ligatures: no-common-ligatures" class=""> (n: </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures" class="">) -&gt; </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">TGString</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">get</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">return</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">TGString</span><span style="font-variant-ligatures: no-common-ligatures" class="">( [</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ar</span><span style="font-variant-ligatures: no-common-ligatures" class="">[n]] )</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; }</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">set</span><span style="font-variant-ligatures: no-common-ligatures" class="">(newValue)</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">if</span><span style="font-variant-ligatures: no-common-ligatures" class=""> newValue.</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">isEmpty</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ar</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">remove</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">(at: n) </span><span style="font-variant-ligatures: no-common-ligatures" class="">// remove element when empty</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">else</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ar</span><span style="font-variant-ligatures: no-common-ligatures" class="">[n] =&nbsp; newValue.</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ar</span><span style="font-variant-ligatures: no-common-ligatures" class="">[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">0</span><span style="font-variant-ligatures: no-common-ligatures" class="">]</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">if</span><span style="font-variant-ligatures: no-common-ligatures" class=""> newValue.</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">count</span><span style="font-variant-ligatures: no-common-ligatures" class=""> &gt; </span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">1</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">insert</span><span style="font-variant-ligatures: no-common-ligatures" class="">(at: n, string: newValue</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">1</span><span style="font-variant-ligatures: no-common-ligatures" class="">..&lt;newValue.</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">count</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">]</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; }</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; }</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 21px;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">subscript</span><span style="font-variant-ligatures: no-common-ligatures" class=""> (r: </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Range</span><span style="font-variant-ligatures: no-common-ligatures" class="">&lt;</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures" class="">&gt;) -&gt; </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">TGString</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">get</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">return</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">TGString</span><span style="font-variant-ligatures: no-common-ligatures" class="">( </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Array</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ar</span><span style="font-variant-ligatures: no-common-ligatures" class="">[r]) )</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; }</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">set</span><span style="font-variant-ligatures: no-common-ligatures" class="">(newValue)</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ar</span><span style="font-variant-ligatures: no-common-ligatures" class="">[r] = </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">ArraySlice</span><span style="font-variant-ligatures: no-common-ligatures" class="">(newValue.</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ar</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; }</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; }</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 21px;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">subscript</span><span style="font-variant-ligatures: no-common-ligatures" class=""> (r: </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">ClosedRange</span><span style="font-variant-ligatures: no-common-ligatures" class="">&lt;</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures" class="">&gt;) -&gt; </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">TGString</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">get</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">return</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">TGString</span><span style="font-variant-ligatures: no-common-ligatures" class="">( </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Array</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ar</span><span style="font-variant-ligatures: no-common-ligatures" class="">[r]) )</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; }</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">set</span><span style="font-variant-ligatures: no-common-ligatures" class="">(newValue)</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ar</span><span style="font-variant-ligatures: no-common-ligatures" class="">[r] = </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">ArraySlice</span><span style="font-variant-ligatures: no-common-ligatures" class="">(newValue.</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ar</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; }</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; }</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 21px;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);" class="">func</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> right( </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);" class="">_</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> len: </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures;" class="">) -&gt; </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);" class="">TGString</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">var</span><span style="font-variant-ligatures: no-common-ligatures" class=""> l = len</span></font></div><p style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 21px;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</span><br class="webkit-block-placeholder"></font></p><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">if</span><span style="font-variant-ligatures: no-common-ligatures" class=""> l &gt; </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">count</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; l = </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">count</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; }</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">return</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">TGString</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Array</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ar</span><span style="font-variant-ligatures: no-common-ligatures" class="">[</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">count</span><span style="font-variant-ligatures: no-common-ligatures" class=""> - l..&lt;</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">count</span><span style="font-variant-ligatures: no-common-ligatures" class="">]))</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; }</font></span></div><p style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 21px;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></font></p><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);" class="">func</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> left(</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);" class="">_</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> len: </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures;" class="">) -&gt; </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);" class="">TGString</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">var</span><span style="font-variant-ligatures: no-common-ligatures" class=""> l = len</span></font></div><p style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 21px;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</span><br class="webkit-block-placeholder"></font></p><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">if</span><span style="font-variant-ligatures: no-common-ligatures" class=""> l &gt; </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">count</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; l = </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">count</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; }</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">return</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">TGString</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Array</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ar</span><span style="font-variant-ligatures: no-common-ligatures" class="">[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">0</span><span style="font-variant-ligatures: no-common-ligatures" class="">..&lt;l]))</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; }</font></span></div><p style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 21px;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></font></p><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);" class="">func</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> mid(</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);" class="">_</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> pos: </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures;" class="">, </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);" class="">_</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> len: </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures;" class="">) -&gt; </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);" class="">TGString</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">if</span><span style="font-variant-ligatures: no-common-ligatures" class=""> pos &gt;= </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">count</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">return</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">TGString</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">empty</span><span style="font-variant-ligatures: no-common-ligatures" class="">()</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; }</font></span></div><p style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 21px;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</span><br class="webkit-block-placeholder"></font></p><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">var</span><span style="font-variant-ligatures: no-common-ligatures" class=""> l = len</span></font></div><p style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 21px;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</span><br class="webkit-block-placeholder"></font></p><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">if</span><span style="font-variant-ligatures: no-common-ligatures" class=""> l &gt; pos + len</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; l = pos + len</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; }</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">return</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">TGString</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Array</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ar</span><span style="font-variant-ligatures: no-common-ligatures" class="">[pos..&lt;pos + l]))</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; }</font></span></div><p style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 21px;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></font></p><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);" class="">func</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> mid(</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);" class="">_</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> pos: </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures;" class="">) -&gt; </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);" class="">TGString</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">if</span><span style="font-variant-ligatures: no-common-ligatures" class=""> pos &gt;= </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">count</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">return</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">TGString</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">empty</span><span style="font-variant-ligatures: no-common-ligatures" class="">()</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; &nbsp; &nbsp; }</font></span></div><p style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 21px;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</span><br class="webkit-block-placeholder"></font></p><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">return</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">TGString</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Array</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ar</span><span style="font-variant-ligatures: no-common-ligatures" class="">[pos..&lt;</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">count</span><span style="font-variant-ligatures: no-common-ligatures" class="">]))</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; }</font></span></div><p style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 21px;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></font></p><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">mutating</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">func</span><span style="font-variant-ligatures: no-common-ligatures" class=""> insert(at: </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures" class="">, string: </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">TGString</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ar</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">insert</span><span style="font-variant-ligatures: no-common-ligatures" class="">(contentsOf: string.</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ar</span><span style="font-variant-ligatures: no-common-ligatures" class="">, at: at)</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; }</font></span></div><p style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 21px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><br class=""></span></p><p style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 21px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;&nbsp;</span><span style="color: rgb(0, 132, 0); font-variant-ligatures: no-common-ligatures;" class="">// Concatenate</span></p><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">static</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">func</span><span style="font-variant-ligatures: no-common-ligatures" class=""> + (left: </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">TGString</span><span style="font-variant-ligatures: no-common-ligatures" class="">, right: </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">TGString</span><span style="font-variant-ligatures: no-common-ligatures" class="">) -&gt; </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">TGString</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">return</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">TGString</span><span style="font-variant-ligatures: no-common-ligatures" class="">(left.</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ar</span><span style="font-variant-ligatures: no-common-ligatures" class=""> + right.</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ar</span><span style="font-variant-ligatures: no-common-ligatures" class="">) )</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; }</font></span></div><p style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 21px;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></font></p><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures" class="">// Return an empty TGString:</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">static</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">func</span><span style="font-variant-ligatures: no-common-ligatures" class=""> empty() -&gt; </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">TGString</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; {</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">return</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">TGString</span><span style="font-variant-ligatures: no-common-ligatures" class="">([</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Character</span><span style="font-variant-ligatures: no-common-ligatures" class="">]())</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">&nbsp; &nbsp; }</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">} </span><span style="font-variant-ligatures: no-common-ligatures" class="">// end TGString</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 21px;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></font></div><div style="margin: 0px; line-height: normal; min-height: 21px;" class=""><font color="#008400" face="Menlo" size="2" class="">// trivial isn’t? but effective...&nbsp;</font></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(209, 47, 27);" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">var</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> strabc = </span><span style="font-variant-ligatures: no-common-ligatures" class="">"abcdefghjiklmnopqrstuvwxyz"</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(209, 47, 27);" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">var</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> strABC = </span><span style="font-variant-ligatures: no-common-ligatures" class="">"ABCDEFGHIJKLMNOPQRSTUVWXYZ"</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">var</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> abc = </span><span style="font-variant-ligatures: no-common-ligatures" class="">TGString</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">(</span><span style="font-variant-ligatures: no-common-ligatures" class="">strabc</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">)</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">var</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> ABC = </span><span style="font-variant-ligatures: no-common-ligatures" class="">TGString</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">(</span><span style="font-variant-ligatures: no-common-ligatures" class="">strABC</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">)</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 21px;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">func</span><span style="font-variant-ligatures: no-common-ligatures" class=""> test()</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">{</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures" class="">// as in Basic: left$, mid$, right$</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">print</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">abc</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">left</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">5</span><span style="font-variant-ligatures: no-common-ligatures" class="">))</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">print</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">abc</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">mid</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">5</span><span style="font-variant-ligatures: no-common-ligatures" class="">,</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">10</span><span style="font-variant-ligatures: no-common-ligatures" class="">))</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">print</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ABC</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">mid</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">5</span><span style="font-variant-ligatures: no-common-ligatures" class="">))</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">print</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ABC</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">right</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">5</span><span style="font-variant-ligatures: no-common-ligatures" class="">))</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures" class="">// ranges and concatenation:</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">print</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">abc</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">12</span><span style="font-variant-ligatures: no-common-ligatures" class="">..&lt;</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">23</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">]</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">print</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">abc</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">left</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">5</span><span style="font-variant-ligatures: no-common-ligatures" class="">) </span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">+</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ABC</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">mid</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">6</span><span style="font-variant-ligatures: no-common-ligatures" class="">,</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">6</span><span style="font-variant-ligatures: no-common-ligatures" class="">) </span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">+</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">abc</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">10</span><span style="font-variant-ligatures: no-common-ligatures" class="">...</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">25</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">]</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></font></div><p style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 21px;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></font></p><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures" class="">// eat anything:</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">let</span><span style="font-variant-ligatures: no-common-ligatures" class=""> d:</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Double</span><span style="font-variant-ligatures: no-common-ligatures" class=""> = </span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">-3.14159</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">print</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">TGString</span><span style="font-variant-ligatures: no-common-ligatures" class="">(d))</span></font></div><p style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 21px;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp;</span><br class="webkit-block-placeholder"></font></p><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">let</span><span style="font-variant-ligatures: no-common-ligatures" class=""> n:</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures" class=""> = </span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">1234</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">print</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">TGString</span><span style="font-variant-ligatures: no-common-ligatures" class="">(n))</span></font></div><p style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 21px;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></font></p><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(39, 42, 216);" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">print</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">TGString</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">(</span><span style="font-variant-ligatures: no-common-ligatures" class="">1234.56789</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">))</span></font></div><p style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 21px;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></font></p><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">let</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> str = </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">abc</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">15</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">..&lt;</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">17</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">]</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">asString</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures" class="">// Copy to to normal Swift String</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">print</span><span style="font-variant-ligatures: no-common-ligatures" class="">(str)</span></font></div><p style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 21px;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></font></p><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">let</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> s = </span><span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b" class="">"</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">\</span><span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">abc</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">12</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">..&lt;</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">20</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">]</span><span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b" class="">)"</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span><span style="font-variant-ligatures: no-common-ligatures" class="">// interpolate to normal Swift String.</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">print</span><span style="font-variant-ligatures: no-common-ligatures" class="">(s)</span></font></div><p style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 21px;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></font></p><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">abc</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">3</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">..&lt;</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">5</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">]</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> = </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">TGString</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b" class="">"34"</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">) </span><span style="font-variant-ligatures: no-common-ligatures" class="">// if lenghts don't match:</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">abc</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">8</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">...</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">9</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">]</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> = </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ABC</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">24</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">...</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">25</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">]</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures" class="">//&nbsp; length of dest. string is altered.</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">abc</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">12</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">]</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> = </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">TGString</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b" class="">"$$$$"</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">)&nbsp; </span><span style="font-variant-ligatures: no-common-ligatures" class="">//&nbsp; if src l &gt; 1 will insert remainder after dest.12 here</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">abc</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">14</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">]</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> = </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">TGString</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b" class="">""</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">)&nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures" class="">//&nbsp; empty removes character at pos.</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">print</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">abc</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">abc</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">insert</span><span style="font-variant-ligatures: no-common-ligatures" class="">(at: </span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">3</span><span style="font-variant-ligatures: no-common-ligatures" class="">, string: </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ABC</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">[</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">0</span><span style="font-variant-ligatures: no-common-ligatures" class="">..&lt;</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">3</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">]</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">print</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">abc</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></font></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">}</font></span></div><p style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 21px;" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp;</span><br class="webkit-block-placeholder"></font></p><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(49, 89, 93);" class=""><font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">test</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">()</span></font></div><div><font size="2" class="">&nbsp;</font></div><div>outputs this:&nbsp;</div><div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><font size="2" class="">abcde</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">fghjiklmno</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">FGHIJKLMNOPQRSTUVWXYZ</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">VWXYZ</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">mnopqrstuvw</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">abcdeGHIJKLklmnopqrstuvwxyz</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">-3.14159</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">1234</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">1234.56789</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">pq</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">mnopqrst</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">abc34fghYZkl$$$nopqrstuvwxyz</font></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">abcABC34fghYZkl$$$nopqrstuvwxyz</font></span></div><div class=""><br class=""></div></div><div><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class=""><div class=""><div class=""><br class=""></div><div class="">Thats not to say that there aren’t features which would simplify/clarify algorithms working in this manner.</div><div class=""><br class=""></div></div></div></div></div></div></blockquote>true.&nbsp;<br class=""><div>This discussion was interesting, triggers further thinking,&nbsp;</div><div>maybe even more because it touched more principal considerations</div><div><br class=""></div><div>As you know, of course, a programming language is always a compromise between human</div><div>and computer “The Machine” so to speak. It started years ago with writing</div><div>Assembler then came higher PLs like Fortran, PL/1 Cobol etc. later C and C++</div><div>to just name a few… Also we see deviations in directions like OOP FP..&nbsp;</div><div>(and everybody thinks they’re right of course even me :o)</div><div><br class=""></div><div>What (even in this time (2017)) &nbsp;often seems to be an unavoidable obstacle</div><div>is the tradeoff/compromise speed/distance-from-the machine, that is,</div><div>how far optimisation aspects are emerging/surfacing through all these&nbsp;</div><div>layers of abstraction into the upper levels of the programming language...&nbsp;</div><div><br class=""></div><div>In this view, the essence of this discussion was perhaps then not the triviality&nbsp;</div><div>wether or not one should instantiate a character array or not, but rather that&nbsp;</div><div>obviously (not only) in Swift these underlying optimisation aspects more or</div><div>less form a undesired restriction… ?&nbsp;</div><div><br class=""></div><div>TedvG.</div><div><div>1980 - from Yes song: "Machine Messiah" - read the lyrics also: very much in context here! &nbsp;</div><div></div></div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class=""><div class=""><div class="">-DW</div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Feb 24, 2017, at 4:27 PM, Ted F.A. van Gaalen via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">ok, I understand, thank you<div class="">TedvG<br class=""><div style="" class=""><blockquote type="cite" class=""><div class="">On 25 Feb 2017, at 00:25, David Sweeris &lt;<a href="mailto:davesweeris@mac.com" class="">davesweeris@mac.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><br class=""><blockquote type="cite" class="">On Feb 24, 2017, at 13:41, Ted F.A. van Gaalen &lt;<a href="mailto:tedvgiosdev@gmail.com" class="">tedvgiosdev@gmail.com</a>&gt; wrote:<br class=""><br class="">Hi David &amp; Dave<br class=""><br class="">can you explain that in more detail?<br class=""><blockquote type="cite" class=""><blockquote type="cite" class="">Wouldn’t that turn simple character access into a mutating function?<br class=""></blockquote></blockquote><br class="">assigning like &nbsp;&nbsp;s[11…14] = str &nbsp;is of course, yes.<br class="">only then - that is if the character array thus has been changed - <br class="">it has to update the string in storage, yes. <br class=""><br class="">but &nbsp;str = s[n..&lt;m] &nbsp;&nbsp;doesn’t. mutate.<br class="">so you’d have to maintain keep (private) a isChanged: Bool or bit.<br class="">a checksum over the character array . &nbsp;<br class="">?<br class=""></blockquote><br class="">It mutates because the String has to instantiate the Array&lt;Character&gt; to which you're indexing into, if it doesn't already exist. It may not make any externally visible changes, but it's still a change.<br class=""><br class="">- Dave Sweeris </div></div></blockquote></div><br class=""></div></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></div></div></div></div></div></div></blockquote></div><br class=""></div></body></html>