diff options
author | Miran <narimiran@disroot.org> | 2019-03-11 11:04:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-11 11:04:08 +0100 |
commit | 06f23572d0299883b55d44872da51d07e876072e (patch) | |
tree | c1bd9b34bddef1d0767b1c8ab5c99722f08a551c /lib/system/strmantle.nim | |
parent | 44d47134f9074dbaf6720af451d402c9f0e53cea (diff) | |
download | Nim-06f23572d0299883b55d44872da51d07e876072e.tar.gz |
system: some documentation improvements (#10809)
Diffstat (limited to 'lib/system/strmantle.nim')
-rw-r--r-- | lib/system/strmantle.nim | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/system/strmantle.nim b/lib/system/strmantle.nim index 3c681fc53..548dacd22 100644 --- a/lib/system/strmantle.nim +++ b/lib/system/strmantle.nim @@ -41,6 +41,13 @@ proc hashString(s: string): int {.compilerproc.} = result = h proc add*(result: var string; x: int64) = + ## Converts integer to its string representation and appends it to `result`. + ## + ## .. code-block:: Nim + ## var + ## a = "123" + ## b = 45 + ## a.add(b) # a <- "12345" let base = result.len setLen(result, base + sizeof(x)*4) var i = 0 @@ -64,6 +71,13 @@ proc nimIntToStr(x: int): string {.compilerRtl.} = result.add x proc add*(result: var string; x: float) = + ## Converts float to its string representation and appends it to `result`. + ## + ## .. code-block:: Nim + ## var + ## a = "123" + ## b = 45.67 + ## a.add(b) # a <- "12345.67" when nimvm: result.add $x else: |