strtabs.html 69 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <!-- This file is generated by Nim. -->
  4. <html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  8. <title>std/strtabs</title>
  9. <!-- Google fonts -->
  10. <link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
  11. <link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
  12. <!-- Favicon -->
  13. <link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
  14. <link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
  15. <!-- CSS -->
  16. <link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
  17. <!-- JS -->
  18. <script type="text/javascript" src="dochack.js?v=2.3.1"></script>
  19. </head>
  20. <body>
  21. <div class="document" id="documentId">
  22. <div class="container">
  23. <h1 class="title">std/strtabs</h1>
  24. <div class="row">
  25. <div class="three columns">
  26. <div class="theme-select-wrapper">
  27. <label for="theme-select">Theme:&nbsp;</label>
  28. <select id="theme-select" onchange="setTheme(this.value)">
  29. <option value="auto">🌗 Match OS</option>
  30. <option value="dark">🌑 Dark</option>
  31. <option value="light">🌕 Light</option>
  32. </select>
  33. </div>
  34. <div id="global-links">
  35. <ul class="simple-boot">
  36. <li><a href="manual.html">Manual</a></li>
  37. <li><a href="lib.html">Standard library</a></li>
  38. <li> <a id="indexLink" href="theindex.html">Index</a></li>
  39. <li><a href="compiler/theindex.html">Compiler docs</a></li>
  40. <li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
  41. <li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
  42. </ul>
  43. </div>
  44. <div id="searchInputDiv">
  45. Search: <input type="search" id="searchInput"
  46. oninput="search()" />
  47. </div>
  48. <ul class="simple simple-toc" id="toc-list">
  49. <li>
  50. <a class="reference reference-toplevel" href="#6" id="56">Imports</a>
  51. </li>
  52. <li>
  53. <details open>
  54. <summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
  55. <ul class="simple simple-toc-section">
  56. <li><a class="reference" href="#FormatFlag" title="FormatFlag = enum
  57. useEnvironment, ## Use environment variable if the ``$key``
  58. ## is not found in the table.
  59. ## Does nothing when using `js` target.
  60. useEmpty, ## Use the empty string as a default, thus it
  61. ## won't throw an exception if ``$key`` is not
  62. ## in the table.
  63. useKey ## Do not replace ``$key`` if it is not found
  64. ## in the table (or in the environment).">FormatFlag</a></li>
  65. <li><a class="reference" href="#StringTableMode" title="StringTableMode = enum
  66. modeCaseSensitive, ## the table is case sensitive
  67. modeCaseInsensitive, ## the table is case insensitive
  68. modeStyleInsensitive ## the table is style insensitive">StringTableMode</a></li>
  69. <li><a class="reference" href="#StringTableObj" title="StringTableObj = object of RootObj">StringTableObj</a></li>
  70. <li><a class="reference" href="#StringTableRef" title="StringTableRef = ref StringTableObj">StringTableRef</a></li>
  71. </ul>
  72. </details>
  73. </li>
  74. <li>
  75. <details open>
  76. <summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
  77. <ul class="simple simple-toc-section">
  78. <ul class="simple nested-toc-section">$
  79. <li><a class="reference" href="#%24%2CStringTableRef" title="`$`(t: StringTableRef): string">`$`(t: StringTableRef): string</a></li>
  80. </ul>
  81. <ul class="simple nested-toc-section">%
  82. <li><a class="reference" href="#%25%2Cstring%2CStringTableRef%2Cset%5BFormatFlag%5D" title="`%`(f: string; t: StringTableRef; flags: set[FormatFlag] = {}): string">`%`(f: string; t: StringTableRef; flags: set[FormatFlag] = {}): string</a></li>
  83. </ul>
  84. <ul class="simple nested-toc-section">[]
  85. <li><a class="reference" href="#%5B%5D%2CStringTableRef%2Cstring" title="`[]`(t: StringTableRef; key: string): var string">`[]`(t: StringTableRef; key: string): var string</a></li>
  86. </ul>
  87. <ul class="simple nested-toc-section">[]=
  88. <li><a class="reference" href="#%5B%5D%3D%2CStringTableRef%2Cstring%2Cstring" title="`[]=`(t: StringTableRef; key, val: string)">`[]=`(t: StringTableRef; key, val: string)</a></li>
  89. </ul>
  90. <ul class="simple nested-toc-section">clear
  91. <li><a class="reference" href="#clear%2CStringTableRef" title="clear(s: StringTableRef)">clear(s: StringTableRef)</a></li>
  92. <li><a class="reference" href="#clear%2CStringTableRef%2CStringTableMode" title="clear(s: StringTableRef; mode: StringTableMode)">clear(s: StringTableRef; mode: StringTableMode)</a></li>
  93. </ul>
  94. <ul class="simple nested-toc-section">contains
  95. <li><a class="reference" href="#contains%2CStringTableRef%2Cstring" title="contains(t: StringTableRef; key: string): bool">contains(t: StringTableRef; key: string): bool</a></li>
  96. </ul>
  97. <ul class="simple nested-toc-section">del
  98. <li><a class="reference" href="#del%2CStringTableRef%2Cstring" title="del(t: StringTableRef; key: string)">del(t: StringTableRef; key: string)</a></li>
  99. </ul>
  100. <ul class="simple nested-toc-section">getOrDefault
  101. <li><a class="reference" href="#getOrDefault%2CStringTableRef%2Cstring%2Cstring" title="getOrDefault(t: StringTableRef; key: string; default: string = &quot;&quot;): string">getOrDefault(t: StringTableRef; key: string; default: string = &quot;&quot;): string</a></li>
  102. </ul>
  103. <ul class="simple nested-toc-section">hasKey
  104. <li><a class="reference" href="#hasKey%2CStringTableRef%2Cstring" title="hasKey(t: StringTableRef; key: string): bool">hasKey(t: StringTableRef; key: string): bool</a></li>
  105. </ul>
  106. <ul class="simple nested-toc-section">len
  107. <li><a class="reference" href="#len%2CStringTableRef" title="len(t: StringTableRef): int">len(t: StringTableRef): int</a></li>
  108. </ul>
  109. <ul class="simple nested-toc-section">mode
  110. <li><a class="reference" href="#mode%2CStringTableRef" title="mode(t: StringTableRef): StringTableMode">mode(t: StringTableRef): StringTableMode</a></li>
  111. </ul>
  112. <ul class="simple nested-toc-section">newStringTable
  113. <li><a class="reference" href="#newStringTable%2Cvarargs%5Bstring%5D%2CStringTableMode" title="newStringTable(keyValuePairs: varargs[string]; mode: StringTableMode): owned(
  114. StringTableRef)">newStringTable(keyValuePairs: varargs[string]; mode: StringTableMode): owned(
  115. StringTableRef)</a></li>
  116. <li><a class="reference" href="#newStringTable%2Cvarargs%5Btuple%5Bstring%2Cstring%5D%5D%2CStringTableMode" title="newStringTable(keyValuePairs: varargs[tuple[key, val: string]];
  117. mode: StringTableMode = modeCaseSensitive): owned(StringTableRef)">newStringTable(keyValuePairs: varargs[tuple[key, val: string]];
  118. mode: StringTableMode = modeCaseSensitive): owned(StringTableRef)</a></li>
  119. <li><a class="reference" href="#newStringTable%2CStringTableMode" title="newStringTable(mode: StringTableMode): owned(StringTableRef)">newStringTable(mode: StringTableMode): owned(StringTableRef)</a></li>
  120. </ul>
  121. </ul>
  122. </details>
  123. </li>
  124. <li>
  125. <details open>
  126. <summary><a class="reference reference-toplevel" href="#15" id="65">Iterators</a></summary>
  127. <ul class="simple simple-toc-section">
  128. <ul class="simple nested-toc-section">keys
  129. <li><a class="reference" href="#keys.i%2CStringTableRef" title="keys(t: StringTableRef): string">keys(t: StringTableRef): string</a></li>
  130. </ul>
  131. <ul class="simple nested-toc-section">pairs
  132. <li><a class="reference" href="#pairs.i%2CStringTableRef" title="pairs(t: StringTableRef): tuple[key, value: string]">pairs(t: StringTableRef): tuple[key, value: string]</a></li>
  133. </ul>
  134. <ul class="simple nested-toc-section">values
  135. <li><a class="reference" href="#values.i%2CStringTableRef" title="values(t: StringTableRef): string">values(t: StringTableRef): string</a></li>
  136. </ul>
  137. </ul>
  138. </details>
  139. </li>
  140. </ul>
  141. </div>
  142. <div class="nine columns" id="content">
  143. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/strtabs.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  144. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/strtabs.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  145. <div id="tocRoot"></div>
  146. <p class="module-desc">The <tt class="docutils literal"><span class="pre">strtabs</span></tt> module implements an efficient hash table that is a mapping from strings to strings. Supports a case-sensitive, case-insensitive and style-insensitive mode.
  147. <p><strong class="examples_text">Example:</strong></p>
  148. <pre class="listing"><span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">strtabs</span>
  149. <span class="Keyword">var</span> <span class="Identifier">t</span> <span class="Operator">=</span> <span class="Identifier">newStringTable</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
  150. <span class="Identifier">t</span><span class="Punctuation">[</span><span class="StringLit">&quot;name&quot;</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="StringLit">&quot;John&quot;</span>
  151. <span class="Identifier">t</span><span class="Punctuation">[</span><span class="StringLit">&quot;city&quot;</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="StringLit">&quot;Monaco&quot;</span>
  152. <span class="Identifier">doAssert</span> <span class="Identifier">t</span><span class="Operator">.</span><span class="Identifier">len</span> <span class="Operator">==</span> <span class="DecNumber">2</span>
  153. <span class="Identifier">doAssert</span> <span class="Identifier">t</span><span class="Operator">.</span><span class="Identifier">hasKey</span> <span class="StringLit">&quot;name&quot;</span>
  154. <span class="Identifier">doAssert</span> <span class="StringLit">&quot;name&quot;</span> <span class="Keyword">in</span> <span class="Identifier">t</span></pre>String tables can be created from a table constructor:
  155. <p><strong class="examples_text">Example:</strong></p>
  156. <pre class="listing"><span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">strtabs</span>
  157. <span class="Keyword">var</span> <span class="Identifier">t</span> <span class="Operator">=</span> <span class="Punctuation">{</span><span class="StringLit">&quot;name&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;John&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;city&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;Monaco&quot;</span><span class="Punctuation">}</span><span class="Operator">.</span><span class="Identifier">newStringTable</span></pre>When using the style insensitive mode (<tt class="docutils literal"><span class="pre">modeStyleInsensitive</span></tt>), all letters are compared case insensitively within the ASCII range and underscores are ignored.
  158. <p><strong class="examples_text">Example:</strong></p>
  159. <pre class="listing"><span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">strtabs</span>
  160. <span class="Keyword">var</span> <span class="Identifier">x</span> <span class="Operator">=</span> <span class="Identifier">newStringTable</span><span class="Punctuation">(</span><span class="Identifier">modeStyleInsensitive</span><span class="Punctuation">)</span>
  161. <span class="Identifier">x</span><span class="Punctuation">[</span><span class="StringLit">&quot;first_name&quot;</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="StringLit">&quot;John&quot;</span>
  162. <span class="Identifier">x</span><span class="Punctuation">[</span><span class="StringLit">&quot;LastName&quot;</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="StringLit">&quot;Doe&quot;</span>
  163. <span class="Identifier">doAssert</span> <span class="Identifier">x</span><span class="Punctuation">[</span><span class="StringLit">&quot;firstName&quot;</span><span class="Punctuation">]</span> <span class="Operator">==</span> <span class="StringLit">&quot;John&quot;</span>
  164. <span class="Identifier">doAssert</span> <span class="Identifier">x</span><span class="Punctuation">[</span><span class="StringLit">&quot;last_name&quot;</span><span class="Punctuation">]</span> <span class="Operator">==</span> <span class="StringLit">&quot;Doe&quot;</span></pre>An efficient string substitution operator <a class="reference external" href="#%25,string,StringTableRef,set[FormatFlag]">%</a> for the string table is also provided.
  165. <p><strong class="examples_text">Example:</strong></p>
  166. <pre class="listing"><span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">strtabs</span>
  167. <span class="Keyword">var</span> <span class="Identifier">t</span> <span class="Operator">=</span> <span class="Punctuation">{</span><span class="StringLit">&quot;name&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;John&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;city&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;Monaco&quot;</span><span class="Punctuation">}</span><span class="Operator">.</span><span class="Identifier">newStringTable</span>
  168. <span class="Identifier">doAssert</span> <span class="StringLit">&quot;${name} lives in ${city}&quot;</span> <span class="Operator">%</span> <span class="Identifier">t</span> <span class="Operator">==</span> <span class="StringLit">&quot;John lives in Monaco&quot;</span></pre><strong>See also:</strong><ul class="simple"><li><a class="reference external" href="tables.html">tables module</a> for general hash tables</li>
  169. <li><a class="reference external" href="sharedtables.html">sharedtables module</a> for shared hash table support</li>
  170. <li><a class="reference external" href="strutils.html">strutils module</a> for common string functions</li>
  171. <li><a class="reference external" href="json.html">json module</a> for table-like structure which allows heterogeneous members</li>
  172. </ul>
  173. </p>
  174. <div class="section" id="6">
  175. <h1><a class="toc-backref" href="#6">Imports</a></h1>
  176. <dl class="item">
  177. <a class="reference external" href="since.html">since</a>, <a class="reference external" href="hashes.html">hashes</a>, <a class="reference external" href="strutils.html">strutils</a>, <a class="reference external" href="assertions.html">assertions</a>, <a class="reference external" href="envvars.html">envvars</a>
  178. </dl>
  179. </div>
  180. <div class="section" id="7">
  181. <h1><a class="toc-backref" href="#7">Types</a></h1>
  182. <dl class="item">
  183. <div id="FormatFlag">
  184. <dt><pre><a href="strtabs.html#FormatFlag"><span class="Identifier">FormatFlag</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
  185. <span class="Identifier">useEnvironment</span><span class="Other">,</span> <span class="Comment">## Use environment variable if the ``$key``</span>
  186. <span class="Comment">## is not found in the table.</span>
  187. <span class="Comment">## Does nothing when using `js` target.</span>
  188. <span class="Identifier">useEmpty</span><span class="Other">,</span> <span class="Comment">## Use the empty string as a default, thus it</span>
  189. <span class="Comment">## won't throw an exception if ``$key`` is not</span>
  190. <span class="Comment">## in the table.</span>
  191. <span class="Identifier">useKey</span> <span class="Comment">## Do not replace ``$key`` if it is not found</span>
  192. <span class="Comment">## in the table (or in the environment).</span></pre></dt>
  193. <dd>
  194. Flags for the <tt class="docutils literal"><span class="pre"><span class="Operator">%</span></span></tt> operator.
  195. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/strtabs.nim#L82" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  196. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/strtabs.nim#L82" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  197. </dd>
  198. </div>
  199. <div id="StringTableMode">
  200. <dt><pre><a href="strtabs.html#StringTableMode"><span class="Identifier">StringTableMode</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
  201. <span class="Identifier">modeCaseSensitive</span><span class="Other">,</span> <span class="Comment">## the table is case sensitive</span>
  202. <span class="Identifier">modeCaseInsensitive</span><span class="Other">,</span> <span class="Comment">## the table is case insensitive</span>
  203. <span class="Identifier">modeStyleInsensitive</span> <span class="Comment">## the table is style insensitive</span></pre></dt>
  204. <dd>
  205. Describes the tables operation mode.
  206. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/strtabs.nim#L69" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  207. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/strtabs.nim#L69" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  208. </dd>
  209. </div>
  210. <div id="StringTableObj">
  211. <dt><pre><a href="strtabs.html#StringTableObj"><span class="Identifier">StringTableObj</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="system.html#RootObj"><span class="Identifier">RootObj</span></a></pre></dt>
  212. <dd>
  213. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/strtabs.nim#L75" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  214. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/strtabs.nim#L75" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  215. </dd>
  216. </div>
  217. <div id="StringTableRef">
  218. <dt><pre><a href="strtabs.html#StringTableRef"><span class="Identifier">StringTableRef</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <a href="strtabs.html#StringTableObj"><span class="Identifier">StringTableObj</span></a></pre></dt>
  219. <dd>
  220. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/strtabs.nim#L80" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  221. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/strtabs.nim#L80" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  222. </dd>
  223. </div>
  224. </dl>
  225. </div>
  226. <div class="section" id="12">
  227. <h1><a class="toc-backref" href="#12">Procs</a></h1>
  228. <dl class="item">
  229. <div id="$-procs-all">
  230. <div id="$,StringTableRef">
  231. <dt><pre><span class="Keyword">proc</span> <a href="#%24%2CStringTableRef"><span class="Identifier">`$`</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <a href="strtabs.html#StringTableRef"><span class="Identifier">StringTableRef</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">extern</span><span class="Other">:</span> <span class="StringLit">&quot;nstDollar&quot;</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
  232. <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  233. <dd>
  234. The <tt class="docutils literal"><span class="pre"><span class="Operator">$</span></span></tt> operator for string tables. Used internally when calling <tt class="docutils literal"><span class="pre"><span class="Identifier">echo</span></span></tt> on a table.
  235. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/strtabs.nim#L376" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  236. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/strtabs.nim#L376" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  237. </dd>
  238. </div>
  239. </div>
  240. <div id="%-procs-all">
  241. <div id="%,string,StringTableRef,set[FormatFlag]">
  242. <dt><pre><span class="Keyword">proc</span> <a href="#%25%2Cstring%2CStringTableRef%2Cset%5BFormatFlag%5D"><span class="Identifier">`%`</span></a><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">t</span><span class="Other">:</span> <a href="strtabs.html#StringTableRef"><span class="Identifier">StringTableRef</span></a><span class="Other">;</span> <span class="Identifier">flags</span><span class="Other">:</span> <a href="system.html#set"><span class="Identifier">set</span></a><span class="Other">[</span><a href="strtabs.html#FormatFlag"><span class="Identifier">FormatFlag</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Other">{</span><span class="Other">}</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.
  243. <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">extern</span><span class="Other">:</span> <span class="StringLit">&quot;nstFormat&quot;</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span>
  244. <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  245. <dd>
  246. The <tt class="docutils literal"><span class="pre"><span class="Operator">%</span></span></tt> operator for string tables.
  247. <p><strong class="examples_text">Example:</strong></p>
  248. <pre class="listing"><span class="Keyword">var</span> <span class="Identifier">t</span> <span class="Operator">=</span> <span class="Punctuation">{</span><span class="StringLit">&quot;name&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;John&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;city&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;Monaco&quot;</span><span class="Punctuation">}</span><span class="Operator">.</span><span class="Identifier">newStringTable</span>
  249. <span class="Identifier">doAssert</span> <span class="StringLit">&quot;${name} lives in ${city}&quot;</span> <span class="Operator">%</span> <span class="Identifier">t</span> <span class="Operator">==</span> <span class="StringLit">&quot;John lives in Monaco&quot;</span></pre>
  250. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/strtabs.nim#L390" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  251. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/strtabs.nim#L390" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  252. </dd>
  253. </div>
  254. </div>
  255. <div id="[]-procs-all">
  256. <div id="[],StringTableRef,string">
  257. <dt><pre><span class="Keyword">proc</span> <a href="#%5B%5D%2CStringTableRef%2Cstring"><span class="Identifier">`[]`</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <a href="strtabs.html#StringTableRef"><span class="Identifier">StringTableRef</span></a><span class="Other">;</span> <span class="Identifier">key</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span>
  258. <span class="Identifier">extern</span><span class="Other">:</span> <span class="StringLit">&quot;nstTake&quot;</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">KeyError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  259. <dd>
  260. <p>Retrieves the location at <tt class="docutils literal"><span class="pre">t[key]</span></tt>.</p>
  261. <p>If <tt class="docutils literal"><span class="pre"><span class="Identifier">key</span></span></tt> is not in <tt class="docutils literal"><span class="pre"><span class="Identifier">t</span></span></tt>, the <tt class="docutils literal"><span class="pre">KeyError</span></tt> exception is raised. One can check with <a class="reference external" href="#hasKey,StringTableRef,string">hasKey proc</a> whether the key exists.</p>
  262. <p>See also:</p>
  263. <ul class="simple"><li><a class="reference external" href="#getOrDefault,StringTableRef,string,string">getOrDefault proc</a></li>
  264. <li><a class="reference external" href="#[]=,StringTableRef,string,string">[]= proc</a> for inserting a new (key, value) pair in the table</li>
  265. <li><a class="reference external" href="#hasKey,StringTableRef,string">hasKey proc</a> for checking if a key is in the table</li>
  266. </ul>
  267. <p><strong class="examples_text">Example:</strong></p>
  268. <pre class="listing"><span class="Keyword">var</span> <span class="Identifier">t</span> <span class="Operator">=</span> <span class="Punctuation">{</span><span class="StringLit">&quot;name&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;John&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;city&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;Monaco&quot;</span><span class="Punctuation">}</span><span class="Operator">.</span><span class="Identifier">newStringTable</span>
  269. <span class="Identifier">doAssert</span> <span class="Identifier">t</span><span class="Punctuation">[</span><span class="StringLit">&quot;name&quot;</span><span class="Punctuation">]</span> <span class="Operator">==</span> <span class="StringLit">&quot;John&quot;</span>
  270. <span class="Identifier">doAssertRaises</span><span class="Punctuation">(</span><span class="Identifier">KeyError</span><span class="Punctuation">)</span><span class="Punctuation">:</span>
  271. <span class="Identifier">echo</span> <span class="Identifier">t</span><span class="Punctuation">[</span><span class="StringLit">&quot;occupation&quot;</span><span class="Punctuation">]</span></pre>
  272. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/strtabs.nim#L155" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  273. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/strtabs.nim#L155" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  274. </dd>
  275. </div>
  276. </div>
  277. <div id="[]=-procs-all">
  278. <div id="[]=,StringTableRef,string,string">
  279. <dt><pre><span class="Keyword">proc</span> <a href="#%5B%5D%3D%2CStringTableRef%2Cstring%2Cstring"><span class="Identifier">`[]=`</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <a href="strtabs.html#StringTableRef"><span class="Identifier">StringTableRef</span></a><span class="Other">;</span> <span class="Identifier">key</span><span class="Other">,</span> <span class="Identifier">val</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">extern</span><span class="Other">:</span> <span class="StringLit">&quot;nstPut&quot;</span><span class="Other">,</span>
  280. <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  281. <dd>
  282. <p>Inserts a <tt class="docutils literal"><span class="pre"><span class="Punctuation">(</span><span class="Identifier">key</span><span class="Punctuation">,</span> <span class="Identifier">value</span><span class="Punctuation">)</span></span></tt> pair into <tt class="docutils literal"><span class="pre"><span class="Identifier">t</span></span></tt>.</p>
  283. <p>See also:</p>
  284. <ul class="simple"><li><a class="reference external" href="#[],StringTableRef,string">[] proc</a> for retrieving a value of a key</li>
  285. <li><a class="reference external" href="#del,StringTableRef,string">del proc</a> for removing a key from the table</li>
  286. </ul>
  287. <p><strong class="examples_text">Example:</strong></p>
  288. <pre class="listing"><span class="Keyword">var</span> <span class="Identifier">t</span> <span class="Operator">=</span> <span class="Punctuation">{</span><span class="StringLit">&quot;name&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;John&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;city&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;Monaco&quot;</span><span class="Punctuation">}</span><span class="Operator">.</span><span class="Identifier">newStringTable</span>
  289. <span class="Identifier">t</span><span class="Punctuation">[</span><span class="StringLit">&quot;occupation&quot;</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="StringLit">&quot;teacher&quot;</span>
  290. <span class="Identifier">doAssert</span> <span class="Identifier">t</span><span class="Operator">.</span><span class="Identifier">hasKey</span><span class="Punctuation">(</span><span class="StringLit">&quot;occupation&quot;</span><span class="Punctuation">)</span></pre>
  291. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/strtabs.nim#L237" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  292. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/strtabs.nim#L237" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  293. </dd>
  294. </div>
  295. </div>
  296. <div id="clear-procs-all">
  297. <div id="clear,StringTableRef">
  298. <dt><pre><span class="Keyword">proc</span> <a href="#clear%2CStringTableRef"><span class="Identifier">clear</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="strtabs.html#StringTableRef"><span class="Identifier">StringTableRef</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  299. <dd>
  300. Resets a string table to be empty again without changing the mode.
  301. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/strtabs.nim#L331" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  302. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/strtabs.nim#L331" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  303. </dd>
  304. </div>
  305. <div id="clear,StringTableRef,StringTableMode">
  306. <dt><pre><span class="Keyword">proc</span> <a href="#clear%2CStringTableRef%2CStringTableMode"><span class="Identifier">clear</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="strtabs.html#StringTableRef"><span class="Identifier">StringTableRef</span></a><span class="Other">;</span> <span class="Identifier">mode</span><span class="Other">:</span> <a href="strtabs.html#StringTableMode"><span class="Identifier">StringTableMode</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">extern</span><span class="Other">:</span> <span class="StringLit">&quot;nst$1&quot;</span><span class="Other">,</span>
  307. <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  308. <dd>
  309. <p>Resets a string table to be empty again, perhaps altering the mode.</p>
  310. <p>See also:</p>
  311. <ul class="simple"><li><a class="reference external" href="#del,StringTableRef,string">del proc</a> for removing a key from the table</li>
  312. </ul>
  313. <p><strong class="examples_text">Example:</strong></p>
  314. <pre class="listing"><span class="Keyword">var</span> <span class="Identifier">t</span> <span class="Operator">=</span> <span class="Punctuation">{</span><span class="StringLit">&quot;name&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;John&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;city&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;Monaco&quot;</span><span class="Punctuation">}</span><span class="Operator">.</span><span class="Identifier">newStringTable</span>
  315. <span class="Identifier">clear</span><span class="Punctuation">(</span><span class="Identifier">t</span><span class="Punctuation">,</span> <span class="Identifier">modeCaseSensitive</span><span class="Punctuation">)</span>
  316. <span class="Identifier">doAssert</span> <span class="Identifier">len</span><span class="Punctuation">(</span><span class="Identifier">t</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">0</span>
  317. <span class="Identifier">doAssert</span> <span class="StringLit">&quot;name&quot;</span> <span class="Keyword">notin</span> <span class="Identifier">t</span>
  318. <span class="Identifier">doAssert</span> <span class="StringLit">&quot;city&quot;</span> <span class="Keyword">notin</span> <span class="Identifier">t</span></pre>
  319. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/strtabs.nim#L313" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  320. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/strtabs.nim#L313" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  321. </dd>
  322. </div>
  323. </div>
  324. <div id="contains-procs-all">
  325. <div id="contains,StringTableRef,string">
  326. <dt><pre><span class="Keyword">proc</span> <a href="#contains%2CStringTableRef%2Cstring"><span class="Identifier">contains</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <a href="strtabs.html#StringTableRef"><span class="Identifier">StringTableRef</span></a><span class="Other">;</span> <span class="Identifier">key</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
  327. <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  328. <dd>
  329. Alias of <a class="reference external" href="#hasKey,StringTableRef,string">hasKey proc</a> for use with the <tt class="docutils literal"><span class="pre"><span class="Keyword">in</span></span></tt> operator.
  330. <p><strong class="examples_text">Example:</strong></p>
  331. <pre class="listing"><span class="Keyword">var</span> <span class="Identifier">t</span> <span class="Operator">=</span> <span class="Punctuation">{</span><span class="StringLit">&quot;name&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;John&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;city&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;Monaco&quot;</span><span class="Punctuation">}</span><span class="Operator">.</span><span class="Identifier">newStringTable</span>
  332. <span class="Identifier">doAssert</span> <span class="StringLit">&quot;name&quot;</span> <span class="Keyword">in</span> <span class="Identifier">t</span>
  333. <span class="Identifier">doAssert</span> <span class="StringLit">&quot;occupation&quot;</span> <span class="Keyword">notin</span> <span class="Identifier">t</span></pre>
  334. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/strtabs.nim#L213" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  335. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/strtabs.nim#L213" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  336. </dd>
  337. </div>
  338. </div>
  339. <div id="del-procs-all">
  340. <div id="del,StringTableRef,string">
  341. <dt><pre><span class="Keyword">proc</span> <a href="#del%2CStringTableRef%2Cstring"><span class="Identifier">del</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <a href="strtabs.html#StringTableRef"><span class="Identifier">StringTableRef</span></a><span class="Other">;</span> <span class="Identifier">key</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  342. <dd>
  343. <p>Removes <tt class="docutils literal"><span class="pre"><span class="Identifier">key</span></span></tt> from <tt class="docutils literal"><span class="pre"><span class="Identifier">t</span></span></tt>.</p>
  344. <p>See also:</p>
  345. <ul class="simple"><li><a class="reference external" href="#clear,StringTableRef,StringTableMode">clear proc</a> for resetting a table to be empty</li>
  346. <li><a class="reference external" href="#[]=,StringTableRef,string,string">[]= proc</a> for inserting a new (key, value) pair in the table</li>
  347. </ul>
  348. <p><strong class="examples_text">Example:</strong></p>
  349. <pre class="listing"><span class="Keyword">var</span> <span class="Identifier">t</span> <span class="Operator">=</span> <span class="Punctuation">{</span><span class="StringLit">&quot;name&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;John&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;city&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;Monaco&quot;</span><span class="Punctuation">}</span><span class="Operator">.</span><span class="Identifier">newStringTable</span>
  350. <span class="Identifier">t</span><span class="Operator">.</span><span class="Identifier">del</span><span class="Punctuation">(</span><span class="StringLit">&quot;name&quot;</span><span class="Punctuation">)</span>
  351. <span class="Identifier">doAssert</span> <span class="Identifier">len</span><span class="Punctuation">(</span><span class="Identifier">t</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">1</span>
  352. <span class="Identifier">doAssert</span> <span class="StringLit">&quot;name&quot;</span> <span class="Keyword">notin</span> <span class="Identifier">t</span>
  353. <span class="Identifier">doAssert</span> <span class="StringLit">&quot;city&quot;</span> <span class="Keyword">in</span> <span class="Identifier">t</span></pre>
  354. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/strtabs.nim#L335" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  355. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/strtabs.nim#L335" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  356. </dd>
  357. </div>
  358. </div>
  359. <div id="getOrDefault-procs-all">
  360. <div id="getOrDefault,StringTableRef,string,string">
  361. <dt><pre><span class="Keyword">proc</span> <a href="#getOrDefault%2CStringTableRef%2Cstring%2Cstring"><span class="Identifier">getOrDefault</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <a href="strtabs.html#StringTableRef"><span class="Identifier">StringTableRef</span></a><span class="Other">;</span> <span class="Identifier">key</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">default</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> <span class="Other">=</span> <span class="StringLit">&quot;&quot;</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.
  362. <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  363. <dd>
  364. <p>Retrieves the location at <tt class="docutils literal"><span class="pre">t[key]</span></tt>.</p>
  365. <p>If <tt class="docutils literal"><span class="pre"><span class="Identifier">key</span></span></tt> is not in <tt class="docutils literal"><span class="pre"><span class="Identifier">t</span></span></tt>, the default value is returned (if not specified, it is an empty string (<tt class="docutils literal"><span class="pre"><span class="StringLit">&quot;&quot;</span></span></tt>)).</p>
  366. <p>See also:</p>
  367. <ul class="simple"><li><a class="reference external" href="#[],StringTableRef,string">[] proc</a> for retrieving a value of a key</li>
  368. <li><a class="reference external" href="#hasKey,StringTableRef,string">hasKey proc</a> for checking if a key is in the table</li>
  369. <li><a class="reference external" href="#[]=,StringTableRef,string,string">[]= proc</a> for inserting a new (key, value) pair in the table</li>
  370. </ul>
  371. <p><strong class="examples_text">Example:</strong></p>
  372. <pre class="listing"><span class="Keyword">var</span> <span class="Identifier">t</span> <span class="Operator">=</span> <span class="Punctuation">{</span><span class="StringLit">&quot;name&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;John&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;city&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;Monaco&quot;</span><span class="Punctuation">}</span><span class="Operator">.</span><span class="Identifier">newStringTable</span>
  373. <span class="Identifier">doAssert</span> <span class="Identifier">t</span><span class="Operator">.</span><span class="Identifier">getOrDefault</span><span class="Punctuation">(</span><span class="StringLit">&quot;name&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;John&quot;</span>
  374. <span class="Identifier">doAssert</span> <span class="Identifier">t</span><span class="Operator">.</span><span class="Identifier">getOrDefault</span><span class="Punctuation">(</span><span class="StringLit">&quot;occupation&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;&quot;</span>
  375. <span class="Identifier">doAssert</span> <span class="Identifier">t</span><span class="Operator">.</span><span class="Identifier">getOrDefault</span><span class="Punctuation">(</span><span class="StringLit">&quot;occupation&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;teacher&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;teacher&quot;</span>
  376. <span class="Identifier">doAssert</span> <span class="Identifier">t</span><span class="Operator">.</span><span class="Identifier">getOrDefault</span><span class="Punctuation">(</span><span class="StringLit">&quot;name&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;Paul&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;John&quot;</span></pre>
  377. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/strtabs.nim#L176" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  378. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/strtabs.nim#L176" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  379. </dd>
  380. </div>
  381. </div>
  382. <div id="hasKey-procs-all">
  383. <div id="hasKey,StringTableRef,string">
  384. <dt><pre><span class="Keyword">proc</span> <a href="#hasKey%2CStringTableRef%2Cstring"><span class="Identifier">hasKey</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <a href="strtabs.html#StringTableRef"><span class="Identifier">StringTableRef</span></a><span class="Other">;</span> <span class="Identifier">key</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">extern</span><span class="Other">:</span> <span class="StringLit">&quot;nst$1&quot;</span><span class="Other">,</span>
  385. <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  386. <dd>
  387. <p>Returns true if <tt class="docutils literal"><span class="pre"><span class="Identifier">key</span></span></tt> is in the table <tt class="docutils literal"><span class="pre"><span class="Identifier">t</span></span></tt>.</p>
  388. <p>See also:</p>
  389. <ul class="simple"><li><a class="reference external" href="#getOrDefault,StringTableRef,string,string">getOrDefault proc</a></li>
  390. <li><a class="reference external" href="#contains,StringTableRef,string">contains proc</a></li>
  391. </ul>
  392. <p><strong class="examples_text">Example:</strong></p>
  393. <pre class="listing"><span class="Keyword">var</span> <span class="Identifier">t</span> <span class="Operator">=</span> <span class="Punctuation">{</span><span class="StringLit">&quot;name&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;John&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;city&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;Monaco&quot;</span><span class="Punctuation">}</span><span class="Operator">.</span><span class="Identifier">newStringTable</span>
  394. <span class="Identifier">doAssert</span> <span class="Identifier">t</span><span class="Operator">.</span><span class="Identifier">hasKey</span><span class="Punctuation">(</span><span class="StringLit">&quot;name&quot;</span><span class="Punctuation">)</span>
  395. <span class="Identifier">doAssert</span> <span class="Keyword">not</span> <span class="Identifier">t</span><span class="Operator">.</span><span class="Identifier">hasKey</span><span class="Punctuation">(</span><span class="StringLit">&quot;occupation&quot;</span><span class="Punctuation">)</span></pre>
  396. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/strtabs.nim#L200" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  397. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/strtabs.nim#L200" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  398. </dd>
  399. </div>
  400. </div>
  401. <div id="len-procs-all">
  402. <div id="len,StringTableRef">
  403. <dt><pre><span class="Keyword">proc</span> <a href="#len%2CStringTableRef"><span class="Identifier">len</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <a href="strtabs.html#StringTableRef"><span class="Identifier">StringTableRef</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">extern</span><span class="Other">:</span> <span class="StringLit">&quot;nst$1&quot;</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
  404. <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  405. <dd>
  406. Returns the number of keys in <tt class="docutils literal"><span class="pre"><span class="Identifier">t</span></span></tt>.
  407. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/strtabs.nim#L151" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  408. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/strtabs.nim#L151" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  409. </dd>
  410. </div>
  411. </div>
  412. <div id="mode-procs-all">
  413. <div id="mode,StringTableRef">
  414. <dt><pre><span class="Keyword">proc</span> <a href="#mode%2CStringTableRef"><span class="Identifier">mode</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <a href="strtabs.html#StringTableRef"><span class="Identifier">StringTableRef</span></a><span class="Other">)</span><span class="Other">:</span> <a href="strtabs.html#StringTableMode"><span class="Identifier">StringTableMode</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
  415. <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  416. <dd>
  417. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/strtabs.nim#L96" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  418. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/strtabs.nim#L96" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  419. </dd>
  420. </div>
  421. </div>
  422. <div id="newStringTable-procs-all">
  423. <div id="newStringTable,varargs[string],StringTableMode">
  424. <dt><pre><span class="Keyword">proc</span> <a href="#newStringTable%2Cvarargs%5Bstring%5D%2CStringTableMode"><span class="Identifier">newStringTable</span></a><span class="Other">(</span><span class="Identifier">keyValuePairs</span><span class="Other">:</span> <a href="system.html#varargs"><span class="Identifier">varargs</span></a><span class="Other">[</span><a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">mode</span><span class="Other">:</span> <a href="strtabs.html#StringTableMode"><span class="Identifier">StringTableMode</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">owned</span><span class="Other">(</span>
  425. <span class="Identifier">StringTableRef</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">extern</span><span class="Other">:</span> <span class="StringLit">&quot;nst$1WithPairs&quot;</span><span class="Other">,</span> </span><span class="Identifier">noSideEffect</span><span class="Other">,</span>
  426. <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  427. <dd>
  428. <p>Creates a new string table with given <tt class="docutils literal"><span class="pre"><span class="Identifier">key</span><span class="Punctuation">,</span> <span class="Identifier">value</span></span></tt> string pairs.</p>
  429. <p><tt class="docutils literal"><span class="pre"><span class="Identifier">StringTableMode</span></span></tt> must be specified.</p>
  430. <p><strong class="examples_text">Example:</strong></p>
  431. <pre class="listing"><span class="Keyword">var</span> <span class="Identifier">mytab</span> <span class="Operator">=</span> <span class="Identifier">newStringTable</span><span class="Punctuation">(</span><span class="StringLit">&quot;key1&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;val1&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;key2&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;val2&quot;</span><span class="Punctuation">,</span>
  432. <span class="Identifier">modeCaseInsensitive</span><span class="Punctuation">)</span></pre>
  433. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/strtabs.nim#L266" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  434. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/strtabs.nim#L266" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  435. </dd>
  436. </div>
  437. <div id="newStringTable,varargs[tuple[string,string]],StringTableMode">
  438. <dt><pre><span class="Keyword">proc</span> <a href="#newStringTable%2Cvarargs%5Btuple%5Bstring%2Cstring%5D%5D%2CStringTableMode"><span class="Identifier">newStringTable</span></a><span class="Other">(</span><span class="Identifier">keyValuePairs</span><span class="Other">:</span> <a href="system.html#varargs"><span class="Identifier">varargs</span></a><span class="Other">[</span><span class="Keyword">tuple</span><span class="Other">[</span><span class="Identifier">key</span><span class="Other">,</span> <span class="Identifier">val</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span><span class="Other">]</span><span class="Other">;</span>
  439. <span class="Identifier">mode</span><span class="Other">:</span> <a href="strtabs.html#StringTableMode"><span class="Identifier">StringTableMode</span></a> <span class="Other">=</span> <span class="Identifier">modeCaseSensitive</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">owned</span><span class="Other">(</span>
  440. <span class="Identifier">StringTableRef</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">extern</span><span class="Other">:</span> <span class="StringLit">&quot;nst$1WithTableConstr&quot;</span><span class="Other">,</span> </span><span class="Identifier">noSideEffect</span><span class="Other">,</span>
  441. <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  442. <dd>
  443. <p>Creates a new string table with given <tt class="docutils literal"><span class="pre"><span class="Punctuation">(</span><span class="Identifier">key</span><span class="Punctuation">,</span> <span class="Identifier">value</span><span class="Punctuation">)</span></span></tt> tuple pairs.</p>
  444. <p>The default mode is case sensitive.</p>
  445. <p><strong class="examples_text">Example:</strong></p>
  446. <pre class="listing"><span class="Keyword">var</span>
  447. <span class="Identifier">mytab1</span> <span class="Operator">=</span> <span class="Identifier">newStringTable</span><span class="Punctuation">(</span><span class="Punctuation">{</span><span class="StringLit">&quot;key1&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;val1&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;key2&quot;</span><span class="Punctuation">:</span> <span class="StringLit">&quot;val2&quot;</span><span class="Punctuation">}</span><span class="Punctuation">,</span> <span class="Identifier">modeCaseInsensitive</span><span class="Punctuation">)</span>
  448. <span class="Identifier">mytab2</span> <span class="Operator">=</span> <span class="Identifier">newStringTable</span><span class="Punctuation">(</span><span class="Punctuation">[</span><span class="Punctuation">(</span><span class="StringLit">&quot;key3&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;val3&quot;</span><span class="Punctuation">)</span><span class="Punctuation">,</span> <span class="Punctuation">(</span><span class="StringLit">&quot;key4&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;val4&quot;</span><span class="Punctuation">)</span><span class="Punctuation">]</span><span class="Punctuation">)</span></pre>
  449. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/strtabs.nim#L283" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  450. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/strtabs.nim#L283" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  451. </dd>
  452. </div>
  453. <div id="newStringTable,StringTableMode">
  454. <dt><pre><span class="Keyword">proc</span> <a href="#newStringTable%2CStringTableMode"><span class="Identifier">newStringTable</span></a><span class="Other">(</span><span class="Identifier">mode</span><span class="Other">:</span> <a href="strtabs.html#StringTableMode"><span class="Identifier">StringTableMode</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">owned</span><span class="Other">(</span><span class="Identifier">StringTableRef</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span>
  455. <span class="Identifier">extern</span><span class="Other">:</span> <span class="StringLit">&quot;nst$1&quot;</span><span class="Other">,</span> </span><span class="Identifier">noSideEffect</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  456. <dd>
  457. <p>Creates a new empty string table.</p>
  458. <p>See also:</p>
  459. <ul class="simple"><li><a class="reference external" href="#newStringTable,varargs[tuple[string,string]],StringTableMode">newStringTable(keyValuePairs) proc</a></li>
  460. </ul>
  461. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/strtabs.nim#L257" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  462. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/strtabs.nim#L257" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  463. </dd>
  464. </div>
  465. </div>
  466. </dl>
  467. </div>
  468. <div class="section" id="15">
  469. <h1><a class="toc-backref" href="#15">Iterators</a></h1>
  470. <dl class="item">
  471. <div id="keys-iterators-all">
  472. <div id="keys.i,StringTableRef">
  473. <dt><pre><span class="Keyword">iterator</span> <a href="#keys.i%2CStringTableRef"><span class="Identifier">keys</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <a href="strtabs.html#StringTableRef"><span class="Identifier">StringTableRef</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  474. <dd>
  475. Iterates over every key in the table <tt class="docutils literal"><span class="pre"><span class="Identifier">t</span></span></tt>.
  476. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/strtabs.nim#L104" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  477. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/strtabs.nim#L104" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  478. </dd>
  479. </div>
  480. </div>
  481. <div id="pairs-iterators-all">
  482. <div id="pairs.i,StringTableRef">
  483. <dt><pre><span class="Keyword">iterator</span> <a href="#pairs.i%2CStringTableRef"><span class="Identifier">pairs</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <a href="strtabs.html#StringTableRef"><span class="Identifier">StringTableRef</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">tuple</span><span class="Other">[</span><span class="Identifier">key</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
  484. <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  485. <dd>
  486. Iterates over every <tt class="docutils literal"><span class="pre"><span class="Punctuation">(</span><span class="Identifier">key</span><span class="Punctuation">,</span> <span class="Identifier">value</span><span class="Punctuation">)</span></span></tt> pair in the table <tt class="docutils literal"><span class="pre"><span class="Identifier">t</span></span></tt>.
  487. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/strtabs.nim#L98" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  488. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/strtabs.nim#L98" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  489. </dd>
  490. </div>
  491. </div>
  492. <div id="values-iterators-all">
  493. <div id="values.i,StringTableRef">
  494. <dt><pre><span class="Keyword">iterator</span> <a href="#values.i%2CStringTableRef"><span class="Identifier">values</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <a href="strtabs.html#StringTableRef"><span class="Identifier">StringTableRef</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  495. <dd>
  496. Iterates over every value in the table <tt class="docutils literal"><span class="pre"><span class="Identifier">t</span></span></tt>.
  497. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/strtabs.nim#L110" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  498. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/strtabs.nim#L110" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  499. </dd>
  500. </div>
  501. </div>
  502. </dl>
  503. </div>
  504. </div>
  505. </div>
  506. <div class="twelve-columns footer">
  507. <span class="nim-sprite"></span>
  508. <br>
  509. <small style="color: var(--hint);">Made with Nim. Generated: 2025-01-09 12:00:16 UTC</small>
  510. </div>
  511. </div>
  512. </div>
  513. <script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
  514. </body>
  515. </html>