diff options
author | flaviut <tamasflaviu@gmail.com> | 2014-04-08 17:51:21 -0400 |
---|---|---|
committer | flaviut <tamasflaviu@gmail.com> | 2014-04-08 17:51:21 -0400 |
commit | 6e70d8afb40f25ef12fbb40585d37d27458e3d73 (patch) | |
tree | 8121e8e14c490cc78d2468c30b40ec27471102a8 | |
parent | fb547ef76b58f16a77c149acb227f746f20edb86 (diff) | |
download | Nim-6e70d8afb40f25ef12fbb40585d37d27458e3d73.tar.gz |
Code examples for string concatination
-rw-r--r-- | lib/system.nim | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/system.nim b/lib/system.nim index 8ce138700..7b6f9716b 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -842,13 +842,28 @@ proc newStringOfCap*(cap: int): string {. proc `&` * (x: string, y: char): string {. magic: "ConStrStr", noSideEffect, merge.} + ## Concatinates `x` with `y` + ## + ## .. code-block:: Nimrod + ## assert("ab" & 'c' == "abc") proc `&` * (x: char, y: char): string {. magic: "ConStrStr", noSideEffect, merge.} + ## Concatinates `x` and `y` into a string + ## + ## .. code-block:: Nimrod + ## assert('a' & 'b' == "ab") proc `&` * (x, y: string): string {. magic: "ConStrStr", noSideEffect, merge.} + ## Concatinates `x` and `y` + ## + ## .. code-block:: Nimrod + ## assert("ab" & "cd" == "abcd") proc `&` * (x: char, y: string): string {. magic: "ConStrStr", noSideEffect, merge.} - ## is the `concatenation operator`. It concatenates `x` and `y`. + ## Concatinates `x` with `y` + ## + ## .. code-block:: Nimrod + ## assert('a' & "bc" == "abc") # implementation note: These must all have the same magic value "ConStrStr" so # that the merge optimization works properly. |