From a3d45d0c1b20982f79b384ddc9af27b745329596 Mon Sep 17 00:00:00 2001 From: Andy Davidoff Date: Mon, 9 Dec 2019 00:58:36 -0500 Subject: add a StringTable.clear that requires no mode specification (#12853) * add clear overload, test, changelog * add since annotation --- changelog.md | 1 + lib/pure/strtabs.nim | 6 +++++- tests/stdlib/tstrtabs.nim | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index d736400f9..18eece00c 100644 --- a/changelog.md +++ b/changelog.md @@ -34,6 +34,7 @@ delimiter instead of '{' and '}'. - introduced new procs in `tables.nim`: `OrderedTable.pop`, `CountTable.del`, `CountTable.pop`, `Table.pop` +- To `strtabs.nim`, added `StringTable.clear` overload that reuses the existing mode. - Added `sugar.outplace` for turning in-place algorithms like `sort` and `shuffle` into diff --git a/lib/pure/strtabs.nim b/lib/pure/strtabs.nim index 4e40aab33..3af21431e 100644 --- a/lib/pure/strtabs.nim +++ b/lib/pure/strtabs.nim @@ -308,7 +308,7 @@ proc getValue(t: StringTableRef, flags: set[FormatFlag], key: string): string = proc clear*(s: StringTableRef, mode: StringTableMode) {. rtlFunc, extern: "nst$1".} = - ## Resets a string table to be empty again. + ## Resets a string table to be empty again, perhaps altering the mode. ## ## See also: ## * `del proc <#del,StringTableRef,string>`_ for removing a key from the table @@ -324,6 +324,10 @@ proc clear*(s: StringTableRef, mode: StringTableMode) {. for i in 0..