@@ -40,14 +40,14 @@ proc hashString(s: string): int {.compilerproc.} =
4040 h = h +% h shl 15
4141 result = h
4242
43- proc add * (result: var string ; x: int64 ) =
43+ proc addInt * (result: var string ; x: int64 ) =
4444 # # Converts integer to its string representation and appends it to `result`.
4545 # #
4646 # # .. code-block:: Nim
4747 # # var
4848 # # a = "123"
4949 # # b = 45
50- # # a.add (b) # a <- "12345"
50+ # # a.addInt (b) # a <- "12345"
5151 let base = result .len
5252 setLen (result , base + sizeof (x)* 4 )
5353 var i = 0
@@ -66,18 +66,22 @@ proc add*(result: var string; x: int64) =
6666 for j in 0 .. i div 2 - 1 :
6767 swap (result [base+ j], result [base+ i- j- 1 ])
6868
69+ proc add * (result: var string ; x: int64 ) {.deprecated :
70+ " Deprecated since v0.20, use 'addInt'" .} =
71+ addInt (result , x)
72+
6973proc nimIntToStr (x: int ): string {.compilerRtl .} =
7074 result = newStringOfCap (sizeof (x)* 4 )
71- result .add x
75+ result .addInt x
7276
73- proc add * (result: var string ; x: float ) =
77+ proc addFloat * (result: var string ; x: float ) =
7478 # # Converts float to its string representation and appends it to `result`.
7579 # #
7680 # # .. code-block:: Nim
7781 # # var
7882 # # a = "123"
7983 # # b = 45.67
80- # # a.add (b) # a <- "12345.67"
84+ # # a.addFloat (b) # a <- "12345.67"
8185 when nimvm :
8286 result .add $ x
8387 else :
@@ -113,9 +117,13 @@ proc add*(result: var string; x: float) =
113117 result .add buf[i]
114118 inc i
115119
120+ proc add * (result: var string ; x: float ) {.deprecated :
121+ " Deprecated since v0.20, use 'addFloat'" .} =
122+ addFloat (result , x)
123+
116124proc nimFloatToStr (f: float ): string {.compilerproc .} =
117125 result = newStringOfCap (8 )
118- result .add f
126+ result .addFloat f
119127
120128proc c_strtod (buf: cstring , endptr: ptr cstring ): float64 {.
121129 importc : " strtod" , header : " <stdlib.h>" , noSideEffect .}
@@ -284,7 +292,7 @@ proc nimParseBiggestFloat(s: string, number: var BiggestFloat,
284292
285293proc nimInt64ToStr (x: int64 ): string {.compilerRtl .} =
286294 result = newStringOfCap (sizeof (x)* 4 )
287- result .add x
295+ result .addInt x
288296
289297proc nimBoolToStr (x: bool ): string {.compilerRtl .} =
290298 return if x: " true" else : " false"
0 commit comments