system: some documentation improvements (#10809)
This commit is contained in:
parent
44d47134f9
commit
06f23572d0
5 changed files with 1412 additions and 820 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue