summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorflaviut <tamasflaviu@gmail.com>2014-04-08 17:56:11 -0400
committerflaviut <tamasflaviu@gmail.com>2014-04-08 17:56:11 -0400
commit2a470c4217e0ee7d002afd7910e875e4079edc08 (patch)
treecdb562207df0652c693277da8b70cd922ca039f0
parent6e70d8afb40f25ef12fbb40585d37d27458e3d73 (diff)
downloadNim-2a470c4217e0ee7d002afd7910e875e4079edc08.tar.gz
Document inplace string appending
-rw-r--r--lib/system.nim14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/system.nim b/lib/system.nim
index 7b6f9716b..6de9f3a8a 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -869,7 +869,21 @@ proc `&` * (x: char, y: string): string {.
 # that the merge optimization works properly. 
 
 proc add*(x: var string, y: char) {.magic: "AppendStrCh", noSideEffect.}
+  ## Appends `y` to `x` in place
+  ##
+  ## .. code-block:: Nimrod
+  ##   var tmp = ""
+  ##   tmp.add('a')
+  ##   tmp.add('b')
+  ##   assert(tmp == "ab")
 proc add*(x: var string, y: string) {.magic: "AppendStrStr", noSideEffect.}
+  ## Concatinates `x` and `y` in place
+  ##
+  ## .. code-block:: Nimrod
+  ##   var tmp = ""
+  ##   tmp.add("ab")
+  ##   tmp.add("cd")
+  ##   assert(tmp == "abcd")
 
 type
   TEndian* = enum ## is a type describing the endianness of a processor.