Replaced deprecated repeatChar() with repeat() or spaces().
This commit is contained in:
parent
8f43979cf6
commit
58186f6c1d
21 changed files with 59 additions and 59 deletions
|
|
@ -471,7 +471,7 @@ proc build_help*(expected: seq[Tparameter_specification] = @[],
|
|||
let width = prefixes.map(proc (x: string): int = 3 + len(x)).max
|
||||
|
||||
for line in zip(prefixes, helps):
|
||||
result.add(line.a & repeatChar(width - line.a.len) & line.b)
|
||||
result.add(line.a & spaces(width - line.a.len) & line.b)
|
||||
|
||||
|
||||
proc echo_help*(expected: seq[Tparameter_specification] = @[],
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import streams
|
||||
from strutils import repeatChar
|
||||
from strutils import repeat
|
||||
|
||||
proc readPaddedStr*(s: PStream, length: int, padChar = '\0'): TaintedString =
|
||||
var lastChr = length
|
||||
|
|
@ -10,7 +10,7 @@ proc readPaddedStr*(s: PStream, length: int, padChar = '\0'): TaintedString =
|
|||
proc writePaddedStr*(s: PStream, str: string, length: int, padChar = '\0') =
|
||||
if str.len < length:
|
||||
s.write(str)
|
||||
s.write(repeatChar(length - str.len, padChar))
|
||||
s.write(repeat(padChar, length - str.len))
|
||||
elif str.len > length:
|
||||
s.write(str.substr(0, length - 1))
|
||||
else:
|
||||
|
|
@ -37,7 +37,7 @@ when isMainModule:
|
|||
testStream.setPosition 0
|
||||
testStream.writePaddedStr("Sup", 10)
|
||||
echo(repr(testStream), testStream.data.len)
|
||||
doAssert testStream.data == "Sup"&repeatChar(7, '\0')
|
||||
doAssert testStream.data == "Sup"&repeat('\0', 7)
|
||||
|
||||
testStream.setPosition 0
|
||||
res = testStream.readPaddedStr(10)
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ when defined(recordMode):
|
|||
isRecording = false
|
||||
proc zeroPad*(s: string; minLen: int): string =
|
||||
if s.len < minLen:
|
||||
result = repeatChar(minLen - s.len, '0')
|
||||
result = repeat(0, minLen - s.len)
|
||||
result.add s
|
||||
else:
|
||||
result = s
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue